Skip to content

Instantly share code, notes, and snippets.

@Nitrodist
Created June 15, 2012 21:01
Show Gist options
  • Save Nitrodist/2938675 to your computer and use it in GitHub Desktop.
Save Nitrodist/2938675 to your computer and use it in GitHub Desktop.
# 10 seconds
TICK = 1
TICKS_PER_MINUTE = 6
# 25 minutes
total_time = 25 * TICKS_PER_MINUTE
puts "Begin pomodoro!"
0.upto(total_time) do |i|
x = case i
when TICK*1; "10 seconds elapsed"
when TICK*TICKS_PER_MINUTE; "60 seconds elapsed"
when TICK*TICKS_PER_MINUTE*5; "5 minutes elapsed"
when TICK*TICKS_PER_MINUTE*10; "10 minutes elapsed"
when TICK*TICKS_PER_MINUTE*15; "15 minutes elapsed"
when TICK*TICKS_PER_MINUTE*20; "20 minutes elapsed"
when TICK*TICKS_PER_MINUTE*25; "All done! Take a break."
end
puts x unless x.nil?
sleep 60/TICKS_PER_MINUTE
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment