by shigemk2

当面は技術的なことしか書かない

2013-09-29から1日間の記事一覧

Hex ColorでRegexp

How to validate Hex color code with regular expression戻り値はnil or 0 hex = '#0000000' rp = Regexp.new("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$") puts hex =~ rp

ディレクトリの中のファイルの差分を知る

rオプションをつける。 diff -r dir1 dir2$ diff -r 40 411 diff -r 40/lib/codebreaker/game.rb 411/lib/codebreaker/game.rb 22c22,24 < @output.puts '+'*exact_match_count(guess) + '-'*number_match_count(guess) --- > marker = Marker.new(@secret) …

cucumber と guard

こんな感じで書いて、色付き、かつpretty表示にさす。 guard 'cucumber', :cli => '--color --format pretty' do watch(%r{^features/.+\.feature$}) watch(%r{^features/step_definitions/.+\.rb$}) end