Skip to content

Instantly share code, notes, and snippets.

@oivoodoo
Created October 12, 2011 13:15
Show Gist options
  • Save oivoodoo/1281200 to your computer and use it in GitHub Desktop.
Save oivoodoo/1281200 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
require 'net/http'
require 'uri'
require 'json'
fork do
loop do
response = Net::HTTP.get_response(URI.parse('http://search.twitter.com/search.json?q=eng_trainer&rpp=1'))
json = JSON.parse response.body
@new_message = json['results'].first['text']
if @old_message != @new_message
system "notify-send \"New word\" \"#{@new_message}\""
@old_message = @new_message
end
sleep 5
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment