Skip to content

Instantly share code, notes, and snippets.

@grundprinzip
Created March 15, 2009 13:57
Show Gist options
  • Save grundprinzip/79421 to your computer and use it in GitHub Desktop.
Save grundprinzip/79421 to your computer and use it in GitHub Desktop.
deadline = Time.gm(2009,3,20,17,0,0)
diff = deadline.localtime - Time.now
if diff < 0
puts "Been there, done that"
exit
end
result = "In "
[[60*60*24, "days"], [60*60, "hours"], [60, "minutes"] ,[1, "seconds"],].inject(diff){ |d,l|
result << ((d / l[0]).to_i).to_s << " " << l[1] << " "
(d % l[0])
}
result << "you will submit to the VLDB!"
puts result
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment