Skip to content

Instantly share code, notes, and snippets.

@ezodude
Created April 30, 2010 00:03
Show Gist options
  • Save ezodude/384482 to your computer and use it in GitHub Desktop.
Save ezodude/384482 to your computer and use it in GitHub Desktop.
Just a little script that shows tweets from a twitter search using figlet displayed on the console for some funky ASCII Art!
# encoding: utf-8
require "rubygems"
require "rest_client"
require "json"
TWEET_TEXT_FONTS = %w(rozzo big fuzzy bulbhead speed nancyj-fancy gothic cosmike straight smisome1 stampatello tinker-toy kban lcd wavy)
tweets = []
while true
res = '[]'
begin
res = RestClient.get 'http://api.twitter.com/search.json?q=podcast%20recommendations'
rescue Exception => e
p [:exception, e]
end
parsed = JSON.parse(res)
next if parsed.empty?
tweets = parsed['results'] - tweets
tweets.each do |tweet|
user = tweet['from_user']
puts `figlet -f doom "@#{user}:"`
sleep 1.5
tweet_content = tweet['text']
tweet_content.split(" ").each { |word|
print `figlet -f #{TWEET_TEXT_FONTS[rand(TWEET_TEXT_FONTS.size - 1)]} "#{word}"`
sleep 1
}
puts "\n\n################################################\n\n "
sleep 10
end
sleep 15
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment