Skip to content

Instantly share code, notes, and snippets.

@bertomartin
Created April 13, 2014 04:42
Show Gist options
  • Save bertomartin/10569525 to your computer and use it in GitHub Desktop.
Save bertomartin/10569525 to your computer and use it in GitHub Desktop.
birthday = Date.parse("YYYY-MM-DD") # XXX: Change me
today = Date.today
total_days = (today - birthday).to_i
mondays = (total_days / 7)
if ((total_days % 7) + birthday.wday) % 7 >= 1
mondays += 1
end
puts "You've had #{mondays} Mondays!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment