Biljenko
and many others are using
Hackety Hack
to learn how to code.
Hackety Hack is a free program for Windows, Mac OS X and Linux that can teach you how to make games, applications and more and share those programs with your friends. You can ask other budding programmers questions and follow them to see what code they're working on through the Hackety Hack website.
Sign up
Learn More
#File: PomoToDo.rb
# A pomodoro timer and to-do list for use with the pomodoro technique.
$round = 0
# The 25-minute work timer
def work_timer
mframe = 25
@pomotimer = every(60) do
@mins.replace "#{mframe -= 1}"
if mframe == 0
@pomotimer.stop
alert "Finished with round #{$round += 1}"
if $round == 4
long_break_timer
else
short_break_timer
end
end
end
end
# The short 5-minute break timer
def short_break_timer
mframe = 5
@mins.replace "5"
@pomotimer = every(60) do
@mins.replace "#{mframe -= 1}"
if mframe == 0
@pomotimer.stop
alert "Back to work"
work_timer
end
end
end
# The long 30-minute break timer
def long_break_timer
mframe = 30
@mins.replace "30"
@pomotimer = every(60) do
@mins.replace "#{mframe -= 1}"
if mframe == 0
@pomotimer.stop
alert "Get ready to start a new round of Pomodoros"
@mins.replace "25"
$round = 0
end
end
end
# Reset the timer and the round count
def reset_timer
@pomotimer.stop
@mins.replace "25"
$round = 0
end
Shoes.app(:title => "PomoToDo", :width => 300, :height => 500, :resizable => false) do
background lightslategray
flow(:margin_left => 125, :margin_top => 20) do
@mins = para "25"
@mins.style(:stroke => limegreen, :font => "Impact", :size => "x-large")
end
# Buttons to control timer
flow(:margin_left => 75) do
button "Start" do
work_timer
end
button "Reset" do
reset_timer
end
end
stack(:margin_left => 25) do
para "-------------------------------------------------"
end
# To-Do List
@task = edit_line(:width => 230, :margin_left => 10)
@task_num = 0
button "Add" do
stack do
flow(:margin_left => 7) do
check
para "#{@task_num += 1}. "
para @task.text
end
end
end
end