Created
October 11, 2013 12:12
-
-
Save potomak/6933669 to your computer and use it in GitHub Desktop.
Get a notification when the NodeKO registration opens.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'eventmachine' | |
require 'em-http-request' | |
EM.run { | |
timer = EM::PeriodicTimer.new(60) do | |
http = EM::HttpRequest.new('http://nodeknockout.com/teams/new').get | |
http.errback { | |
puts 'Uh oh' | |
} | |
http.callback { | |
puts "Error (#{http.response_header.status})" if http.response_header.status != 200 | |
is_full = http.response.match('Registration is currently full') | |
puts "#{Time.now} - #{is_full ? 'Registration is currently full' : 'Go now!'}" | |
%x[notify-send "NodeKO" "It's time to register!"] unless is_full | |
} | |
end | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ahaha