Skip to content

Instantly share code, notes, and snippets.

Created June 4, 2015 22:07
Show Gist options
  • Save anonymous/5e424d1920aea9b6b65f to your computer and use it in GitHub Desktop.
Save anonymous/5e424d1920aea9b6b65f to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
h, m, = 12, 07
$_.gsub!(/(\d\d):(\d\d)/) do
'%02d:%02d' % (($1.to_i + h) * 60 + $2.to_i + m).divmod(60)
end
@baweaver
Copy link

baweaver commented Jun 4, 2015

SECOND = 1
MINUTE = SECOND * 60
HOUR = MINUTE * 60
DAY = HOUR * 24
WEEK = DAY * 7
YEAR = DAY * 365.26

def seconds(x) x * SECOND end
def minutes(x) x * MINUTE end
def hours(x) x * HOUR end
def days(x) x * DAY end
def weeks(x) x * WEEK end
def years(x) x * years end

Time.now + days(10)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment