Because I'm both lazy and wanting to mess around more with time management and Ruby, I thought it would be fun to create a simple script that opens Code Review once every day to go towards the daily login badge awards! There are so many ways to go about this that I'm certain you could probably do this within several lines of code (especially with Ruby).
require 'launchy'
module BadgeBot
def at_time(time)
loop do
before = Time.now
yield
interval = time - (Time.now - before)
sleep interval if interval > 0
end
end
# every 23 hours, open the webpage
at_time(82800) do
Launchy.open('http://codereview.stackexchange.com/')
end
end
I'm also aware that there's no code to handle closing the browser. This is handled manually, because as a software developer I'd be ashamed if I didn't attend the computer once at some point in the day.