Inspired by Ben Orienstein's talk.
Use this:
history | awk '{CMD[$2]++;count++;}END { for (a in CMD)print CMD[a] " " CMD[a]/count*100 "% " a;}' | grep -v "./" | column -c3 -s " " -t | sort -nr | nl | head -n10
| ## Default array as argument | |
| bad = Hash.new([]) | |
| bad[1] <<= 1 | |
| bad[2] <<= 2 | |
| bad | |
| # => {1=>[1, 2], 2=>[1, 2]} | |
| ## Default array from block |
| ## Splatting an array | |
| arr = [1, 2, 3] | |
| a = [arr, 4] | |
| # => [[1, 2, 3], 4] | |
| b = [*arr, 4] | |
| # => [1, 2, 3, 4] |