-
-
Save dcarral/807c6c9e4032a5705e47eda896c876e3 to your computer and use it in GitHub Desktop.
Timer for coderetreat session
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# Uso: ruby timer.rb "mensaje anunciando el final del ciclo" | |
# o alternativamente: chmod +x timer.rb and ./timer.rb | |
# + info en http://archive.coderetreat.org/profiles/blogs/new-session-idea-baby-steps | |
message = ARGV[0] || "Time over" | |
minutes = 2 | |
seconds = minutes * 60 | |
while(true) | |
STDOUT.puts "Empezando ciclo de #{minutes} minutos." | |
seconds.times do |index| | |
STDOUT.print "." | |
sleep(1) | |
end | |
`say "#{message}"` | |
STDOUT.puts | |
STDOUT.puts "Presionando enter/return puedes empezar un nuevo ciclo." | |
STDIN.getc | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment