Skip to content

Instantly share code, notes, and snippets.

@erutaso
Forked from kazoo04/ginko_timer.rb
Created March 21, 2014 12:58
Show Gist options
  • Save erutaso/9685606 to your computer and use it in GitHub Desktop.
Save erutaso/9685606 to your computer and use it in GitHub Desktop.
# encoding: utf-8
require 'date'
require './timer.rb'
@last_update = nil
def tweet
d = DateTime.now
return if @last_update and @last_update.hour == d.hour
if d.hour == 21
p 'update'
end
@last_update = d
end
timer = Timer.new(1) {
Thread.new() {
p 'tweet()'
tweet
}
}
timer.start
loop do
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment