2015-07-18から1日間の記事一覧
https://bugs.ruby-lang.org/issues/4147 Ruby自体ではサポートされてないらしい Gemを使う https://github.com/ryanlecompte/weighted_randomizer
arr = (1..1000).to_a.map{(1..10).to_a.sample}.sort; # (1..10).to_a.sample(1000)ではできない。(Array#sampleでは復元抽出はできない?) p arr; >[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, …
http://qiita.com/yukiko-kato-bass/items/6dfd8cd9d666a8ee3a77 RAILS_ENV=production rake secret
特に配列を操作するときにダンプを抑制したいことがある http://qiita.com/ainoya/items/0aea440faa5d78630c9a 行末に;(セミコロン)を置く