Created
March 1, 2009 07:50
-
-
Save ELLIOTTCABLE/72260 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| %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