2011-01-01から1年間の記事一覧

phpstylist.vim

プロジェクト毎に規約が変わったりするので、id:oppara:20111006 をプラグイン化 (phpStylistのラッパー)GitHub - oppara/phpstylist.vim: wrapper for phpStylist 設定方法 .vimrc " phpStylist.php へのパス let g:phpstylist_cmd_path = '/path/to/phpS…

特定のurlだけhttpsアクセス

//example.com/hoge/ と //example.com/moge/ は https RewriteEngine On RewriteCond %{HTTPS} on RewriteCond %{REQUEST_URI} !(^/(hoge|moge)/) RewriteRule ^(.*) http://%{HTTP_HOST}/$1 [R=301,L] RewriteCond %{HTTPS} on RewriteCond %{REQUEST_URI}…

AndroidSDK

Android 1.6(API 4)を入れたら認識した。TiDev Communityのエラーメッセージのおかげ!!

CoffeeScriptインストール

node.js % git clone git://github.com/joyent/node.git node.git % cd node.git % ./configure % make % make install npm % curl http://npmjs.org/install.sh | sudo sh CoffeeScript % sudo npm install -g coffee-script

tigのインストール

libiconv, ncurses はインストール済み % port installed The following ports are currently installed: libiconv @1.14_0+cp932fix+enable_cp932fix (active) ncurses @5.9_1 (active) とりあえず、依存関係確認 % port deps tig Full Name: tig @0.17_0 L…

各設定ファイル読み込み順

zsh

ログインシェル ~/.zshenv ~/.zprofile2 件 ~/.zshrc ~/.zlogin インタラクティブシェル ~/.zshenv ~/.zshrc シェルスクリプト ~/.zshenv

選択範囲をphpStylist

phpStylist.php がファイルしか受付ないようだったので、力技。

オプションが最後に設定された場所

vim

:help set-verbose :verbose set shiftwidth cindent? https://sites.google.com/site/vimdocja/options-html#:set-verbose

prologのインストール

どれがどれだか... % port search prolog | grep lang | grep -v editor gprolog @1.4.0 (lang) gprolog-devel @1.4.0 (lang) swi-prolog @5.10.5 (lang) swi-prolog-devel @5.11.26 (lang) swi-prolog-lite @5.8.3 (lang) yap @6.0.5 (lang) yap-devel @6.0…

php4のopenidライブラリ

php

OpenID Enabled php4 で動作確認してなさそうなので、fork GitHub - oppara/php4-openid: OpenID library for PHP4

パスが設定されていなかったら設定

sh

echo "$PATH" | grep -Fqv "$my_path" && export PATH="$my_path:$PATH"

空き容量確保

% port -u uninstall % port clean --all installed

Finderの再起動

osx

% killall Finder

cssでflymake

GitHub - CSSLint/csslint: Automated linting of Cascading Stylesheetsnode.jsで動かす % sudo npm install -g csslint使い方 % csslint hoge.css % csslint --helpdefautlのruleは厳しいので % csslint --rules=display-property-grouping,ids,qualified-…

snipMate.vim ShowAvailableSnips()

vim

ino <silent> <c-r><tab> <c-r>=ShowAvailableSnips()<cr> Vim の snipMate.vim プラグインを改造して、1キーで trigger の展開と補完をできるようにする (フェンリル | デベロッパーズブログ) は、1キーとは言わないと思ったり。。</cr></c-r></tab></c-r></silent>

タブ区切りで書き出し

% psql -U user db -A -F"`echo -e '\t'`" -c 'sql' > out.tsv

空のディレクトリに.emptyを追加する

git

% find . -type d -empty -not -path './.git*' -exec touch {}\/.empty \;.gitignore % find . -type d -empty -not -path './.git*' -exec touch {}\/.gitignore \;

256 colors

zsh

% for i in {0..255}; do echo -e "\e[38;05;${i}m${i}"; done | column -c 200 Show numerical values for each of the 256 colors in ZSH

unite-cake.vim

https://github.com/oppara/vim-unite-cake(unite-rails をパク参考にしました) ただし、見様見真似なため、emptyファイルを無視できず... できた!

配列のすべてのキーを変更する

php

PHP: array_change_key_case - Manual とりあえずベンチとってみる http://net-beta.net/ubench/ PHP 5.2.13 % time php -f array_change_key_case.php php -f array_change_key_case.php 0.26s user 0.01s system 97% cpu 0.275 total % time php -f foreac…

セレクトボックスでsubmit

(function() { $(SELECT).change(function() { $(this).closest('form').submit(); }); })();

Paginator::prev(), Paginator::next()のバグ?

1ページしかない時、disabledOptionsがemptyでない場合、escape => false が無視される。 escapeさせる場合は、disabledOptionsにescapeの設定を追加する必要がある。 false ); $disabled_options = array( 'class' => 'disabled' ); echo $this->Paginator…

.htaccessで相対パス対応

例えば ../img/foobar/hoge.png を img/foobar/hoge.png にしたい 画像は、webroot/img/の中に全て入ってるという条件 RewriteRule ^.*\/((img|js|css)\/.*\.(png|gif|jp?g|js|css))$ $1 [NC,L]

unite.vim

vim

GitHub - Shougo/unite.vim: Unite and create user interfaces やっと移行(ネコはまだ)機能ありまくり...; if exists('g:loaded_unite') let g:unite_source_file_mru_limit = 200 let g:unite_source_file_mru_filename_format = '' nnoremap <silent> fff :<C-u>Unit</c-u></silent>…

Controllerのテスト(redirect)

CakePHP 1.3.8 testAction()すると、モノホンのdispatcherが呼ばれる模様。 なので、テストケースのファイルにテストコントローラを書いても、testAction()時は無視されるし、 routing書き換えても、testAction()時のコントローラと、startTest()時のコント…

order by カナ

initdbなんてやってられないので、 'ORDER BY substring( kana_field from 1 for 1)'

全てのsubmoduleを一括更新

git

% git submodule foreach 'git checkout master; git pull origin master'

シーケンスをリセット

SELECT setval('qanda_qanda_no_seq', 1, FALSE);

CSSTidy

% csstidy input_filename --preserve_css=true --silent=true --template=opp

OSX + iTerm + screen + vim + 256 colors

This Page Has Movedscreen (Git!!!!) % git clone git://git.savannah.gnu.org/screen.git % cd screen/src % ./autogen.sh % ./configure --prefix=/usr/local \ --enable-telnet \ --enable-pam \ --enable-colors256 \ --enable-rxvt_osc \ --enable-use…