Skip to content

Instantly share code, notes, and snippets.

@potomak
Created October 11, 2013 12:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save potomak/6933669 to your computer and use it in GitHub Desktop.
Save potomak/6933669 to your computer and use it in GitHub Desktop.
Get a notification when the NodeKO registration opens.
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
}
@ricogallo
Copy link

ahaha

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment