Skip to content

Instantly share code, notes, and snippets.

@ELLIOTTCABLE
Created March 1, 2009 07:50
Show Gist options
  • Select an option

  • Save ELLIOTTCABLE/72260 to your computer and use it in GitHub Desktop.

Select an option

Save ELLIOTTCABLE/72260 to your computer and use it in GitHub Desktop.
%w(yaml json em-http cgi).each {|dep| require dep }
require 'pp' # DEBUG
require 'talkieme/config'
STDOUT.sync = true
module TalkieMe
Version = 2
class <<self
def start
EventMachine.run do
update_followers!
@@searcher = EventMachine::MultiRequest.new
EventMachine.add_periodic_timer(1) do
STDOUT.print "."
@@searcher.add EventMachine::HttpRequest.new('http://search.twitter.com/search.json?q=%23GetARoom+OR+%23TakeItToTalkie+OR+%23TalkieMe').get
end
@@searcher.callback do
pp @@searcher.responses[:succeeded] # DEBUG
pp @@searcher.responses[:failed] # DEBUG
end
end
end
private
def update_followers!
# followers = JSON.parse(open("http://twitter.com/statuses/followers.json", :http_basic_authentication => [Config[:username], Config[:password]]).read).map {|f| f['screen_name'] }
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment