Skip to content

Instantly share code, notes, and snippets.

@nukisashineko
Created October 13, 2017 16:46
Show Gist options
  • Save nukisashineko/d89370668741fd2f7e361f27dc241a32 to your computer and use it in GitHub Desktop.
Save nukisashineko/d89370668741fd2f7e361f27dc241a32 to your computer and use it in GitHub Desktop.
# 13日の金曜日って多めに出現するのかなって言ってた人が居たので調べたら、そんな事なかった。
# 逆に満遍なく曜日と日付が周期していてちょっと驚いたかも
# 29、30、31日の追加で上手く調整しているんだなぁ。って改めて思った。
require 'date'
hash = Hash.new(0)
(Date.new(1990,1,1)..Date.new(2017,12,31)).each do |t|
hash[[t.strftime('%a') , t.day ]]+=1
end
p hash[['Fri',13]]
p Hash[ hash.sort_by{ |_, v| -v } ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment