Skip to content

Instantly share code, notes, and snippets.

install plenv

$ git clone git://github.com/tokuhirom/plenv.git ~/.plenv
$ git clone git://github.com/tokuhirom/Perl-Build.git ~/.plenv/plugins/perl-build/
$ echo 'export PATH="$HOME/.plenv/bin:$PATH"' >> ~/.bash_profile
$ echo 'eval "$(plenv init -)"' >> ~/.bash_profile
$ exec $SHELL -l
$ git config --global core.autoCRLF false
MS-DOSやWindowsなどではCRLFを、かつてのMac OSなどではCRを、UNIX系システムと現在のMac OS XなどではLFをそれぞれ用いる。
@libitte
libitte / gist:50481664243ecd35ca14
Last active August 29, 2015 14:02
login shell を homebrew でインストールした zsh に変更
chsh -s /usr/local/bin/zsh
http://soramugi.hateblo.jp/entry/2013/12/01/150433
http://qiita.com/soramugi/items/7014c866b705e2cd0b95
tagsファイルがおいてあるディレクトリのソースコードをvim開く
定義したクラスや関数名の上で Ctrl+] を押すと、クラスや関数の定義元に移動できる
前の場所に戻る時は Ctrl+t もしくは Ctrl+o を押すか、:pop を実行する
他に、ctagsを利用する上で覚えておくと便利な点は以下の通り
C-w}でプレビューウィンドウで開ける。プレビューウィンドウは C-wC-z もしくは :pc で閉じることができる
:tags を実行することで、タグの移動経路を事前に確認することができる
ls, buffers, files 開いているバッファ一覧(バッファリスト)を表示する
bfirst,bf 先頭のバッファに移動する
blast,bl 最後のバッファに移動する
bnext,bn 次のバッファに移動する
bprev,bp 前のバッファに移動する
b NUM NUM番目のバッファに移動する
badd バッファにファイルをロードする
bdelete バッファをアンロードする
# git の branch 名を表示する方法
#.bashrc
# git settings
source /usr/local/etc/bash_completion.d/git-prompt.sh
source /usr/local/etc/bash_completion.d/git-completion.bash
GIT_PS1_SHOWDIRTYSTATE=true
export PS1='\[\033[32m\]\u@\h\[\033[00m\]:\[\033[34m\]\w\[\033[31m\]$(__git_ps1)\[\033[00m\]\$ '
== 10進法 -> 2進法, 2進法 -> 10進法
http://detail.chiebukuro.yahoo.co.jp/qa/question_detail/q1210460042
- 2 -> 10
ex) 1111001
1*2^6 + 1*2^5 + 1*2^4 + 1*2^3 + 1*2^0
64+32+16+8+1
@libitte
libitte / commit_log_should_current.md
Last active August 29, 2015 13:56
commit log は過去形?現在形?

commit log は過去形?現在形?

現在形 が望ましい。 プログラマが、Gitのレポジトリに対して、このようにふるまいを変えろと命令している様をイメージすればよい。

Describe your changes in imperative mood, e.g. "make xyzzy do frotz" instead of "[This patch] makes xyzzy do frotz" or "[I] changed xyzzy to do frotz", as if you are giving orders to the codebase to change its behaviour. Try to make sure your explanation can be understood without external resources.

user ごとの 件数のうち最大件数をしらべる

SELECT MAX(counted) FROM
(
SELECT COUNT(*) AS counted
FROM table_actions
WHERE status = "good"
  • 配列の差分

@A - @B

my @A = qw(1 2 3 4 5 6 7 8 9);
my @B = qw(3 5 9);
 
my %cnt = ();
map { $cnt{$_}-- } @B;