Skip to content

Instantly share code, notes, and snippets.

@oivoodoo
Created October 18, 2011 06:48
Show Gist options
  • Save oivoodoo/1294772 to your computer and use it in GitHub Desktop.
Save oivoodoo/1294772 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
# Script for learning english by twitter eng_trainer bot.
require 'rubygems'
require 'net/http'
require 'uri'
require 'json'
fork do
loop do
response = Net::HTTP.get_response(URI.parse('http://api.twitter.com/1/statuses/user_timeline.json?user_id=177973554&count=1'))
json = JSON.parse response.body
@new_message = json.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