Skip to content

Instantly share code, notes, and snippets.

@dcarral
Forked from coreyhaines/timer.rb
Last active November 17, 2017 20:16
Show Gist options
  • Save dcarral/807c6c9e4032a5705e47eda896c876e3 to your computer and use it in GitHub Desktop.
Save dcarral/807c6c9e4032a5705e47eda896c876e3 to your computer and use it in GitHub Desktop.
Timer for coderetreat session
#!/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