scriptonia

Oct 18 '11

Script for learning english words with translation into russian.

#!/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
view raw words This Gist brought to you by GitHub.

View comments

Blog comments powered by Disqus