Skip to content

Instantly share code, notes, and snippets.

@why404
Forked from coderberry/twit_search_growl.rb
Created November 16, 2009 08:02
Show Gist options
  • Save why404/235835 to your computer and use it in GitHub Desktop.
Save why404/235835 to your computer and use it in GitHub Desktop.
require 'rubygems'
require 'twitter'
require 'ruby-growl'
last_tweet_id = 0
loop do
result = Twitter::Search.new('teachmetocode').since(last_tweet_id).fetch().results.first
if result
from_user = result[:from_user]
text = result[:text]
last_tweet_id = result[:id]
g = Growl.new "localhost", "ruby-growl", ["ruby-growl Notification"]
g.notify "ruby-growl Notification", from_user, text
else
puts "No results.."
end
sleep 30
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment