Skip to content

Instantly share code, notes, and snippets.

@danielevans
Created June 26, 2013 16:50
Show Gist options
  • Save danielevans/5869148 to your computer and use it in GitHub Desktop.
Save danielevans/5869148 to your computer and use it in GitHub Desktop.
Counting Sundays
require 'date'
sundays = (1901..2000).reduce(0) do |memo, year|
memo + (1..12).count do |month|
Date.new(year, month, 1).sunday?
end
end
puts sundays
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment