Skip to content

Instantly share code, notes, and snippets.

@zakuroishikuro
Last active August 29, 2015 14:12
Show Gist options
  • Save zakuroishikuro/50286e86924383a5634d to your computer and use it in GitHub Desktop.
Save zakuroishikuro/50286e86924383a5634d to your computer and use it in GitHub Desktop.
プロ生ちゃんのカレンダーのあれ (Ruby) ref: http://qiita.com/zakuroishikuro/items/6a1cdc48609875b8e131
require 'date'
last = Date.new(Time.now.year, Time.now.month, -1)
days = (1..last.day).map{|d| '%2d' % d}
days.unshift *[nil] * (last + 1 << 1).wday
puts last.strftime "%B %Y"
puts days.each_slice(7).map{|week| week * "\t"}
January 2015
1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment