- cmd + k の後にキーを離して上下左右で、そちらへのペイン分割。移動はcmd + k の後にキーを離して cmd + n/p。とじはcmd + k の後にキーを離してcmd + w
- ctrl + cmd + m で現在の カッコ内を全選択。 大カッコとかも含むんで、配列の中ぜん選択とかもできて便利!
alt + cmd + .
で 直近のタグを閉じる
- http://qiita.com/ogomr/items/71e4d2024794ea08d978 でまずはキーの読み方覚えないとイカン。
cmd + ctrl + d
: Mac標準搭載の辞書で選択箇所の訳が出る。イイcommand + option + D
で dock の on/offsudo nvram boot-args=niog=1
で、閉じず(クラムシェルモード)に外部ディスプレイへ出せる?open .
で、カレントディレクトリを finder で開ける
推奨できる物かは知らないけど個人的に楽
Mac OS X + zsh + chruby
ruby_version=$(grep '#define RUBY_VERSION' version.h | grep -o -E '[0-9.]+')
ruby_bin=ruby-${ruby_version}dev.$(git rev-parse --short trunk)
./configure --prefix="$HOME/.rubies/$ruby_bin" --disable-install-doc
make install
source /usr/local/share/chruby/chruby.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
☻ ./tmp/bin/rbx -e 'Array.new(2 ** 29)' ruby-2.3.0p0 spec-public-send-with-protected-method 3c32123 | |
The Rubinius process is aborting with signal: SIGSEGV | |
--- begin system info --- | |
node info: MacBook-Pro-2.local Darwin Kernel Version 15.5.0: Tue Apr 19 18:36:36 PDT 2016; root:xnu-3248.50.21~8/RELEASE_X86_64 | |
--- end system info --- | |
--- begin rubinius info --- | |
process info: kachick rbx 6414 3.3.c713 2.3.1 2016-07-21 f0373ac0 3.6.2 JIT disabled | |
--- end rubinius info --- | |
--- begin system backtrace --- | |
0 rbx 0x000000010b9eda53 _ZN8rubiniusL20abandon_ship_handlerEi + 259 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Hash | |
def p_diff(b) | |
merged_keys = keys | b.keys | |
merged_keys.each do |k| | |
case | |
when key?(k) && b.key?(k) | |
value = self[k] | |
if value == b[k] | |
puts "a,b: #{k.inspect} => #{value.inspect} == #{b[k].inspect}" | |
else |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def utc_from_jst(*args) | |
ActiveSupport::TimeZone.new('Asia/Tokyo').utc_offset.seconds.ago Time.zone.local(*args) | |
end |
- or とか使えて便利な arel_table だけど、そもそも Rails が public に提供している API では無い
- rails/rails#16978 (comment)
- http://edgeguides.rubyonrails.org/api_documentation_guidelines.html#method-visibility
- ということで、 Rails5 から ActiveRecord::Relation#or が使えるようになった(whereから繋げられる)
- バックポートgemとかも登場してきているよ
Ruby の beginrescueend 構文では例外クラスを指定しろという説明が多い気するけど、includeしているmoduleとかでも拾えるんでもっと柔軟だよねというアレ
module Role end
class Foo < Exception
include Role
end
begin
久しぶりに Mac OS X で rubinius build しようとしたら躓いた。 ぐぐってさっくり解決したとこをすっ飛ばすと、時間かかったのがここ
$ ./configure
Checking clang: found
Checking clang++: found
Checking for 'llvm-config': only LLVM 3.0-3.5 is supported
ABORT: unable to set up LLVM
キーボードの調子おかしくなってきて掃除した時、UpAllow↑キーの中のふにゃふにゃとキーカバーが上手くはまらないままどっかいっちゃった ベテランは使わないキーな気もするけど自分にとっては慣れ親しんだキーなので結構困る。 幸い?すぐそばの右シフトは使わなかったんでこれを差し替えて凌いでる。
# まずはxenvで
xenv
# 差し替え対象と差し替え先のキーを叩いてキーコード確認する。それさえ出来ない時も「xmodmap -pke」でなんとなく読める一覧は得られる
# 変更コマンドファイル作ってxmodmapに読み込ませる