One-Line Countdown Timer

I don’t have any countdown timer app installed, but I have Ruby…

And it takes less than a minute to write a simple countdown timer app in the irb console.

fin = Time.now + 5 * 60; while Time.now < fin; puts fin — Time.now; sleep 1; end

You can even set it to play some annoying sound afterwards.

; system "play -n synth 0.1 square 1228"

Code, Applied to Life

Code, Applied to Life

Stories about how coding can be applied to solve everyday life problems. (Formerly Ruby Everyday).

Thai Pangsakulyanont

Written by

(@dtinth) A software engineer and frontend enthusiast. A Christian. A JavaScript musician. A Ruby and Vim lover.

Code, Applied to Life

Stories about how coding can be applied to solve everyday life problems. (Formerly Ruby Everyday).