TwitterBrite 5

Posted by Aaron Patterson on February 22, 2008

I signed up my BetaBrite for a twitter account. Now I’m getting twitter messages in my living room. Yay! Leave a comment, or follow me on twitter so I can get your messages on my sign. I think next I will try to wire up a webcam to automagically take pictures.

Anyway, here is the code:

twitter = Twitter::Base.new('betabrite', '%%%%%%%%')

seen = {}
DATA.each_line { |l| seen[l.chomp] = true }
twit = nil
twitter.timeline(:friends).each do |tweet|
  next if seen[tweet.id]
  twit = tweet
end

if twit
  File.open(__FILE__, 'a') { |db| db.puts(twit.id) }
  puts "#{twit.text} (#{twit.user.name})"
  bb = BetaBrite::USB.new { |sign|
    sign.stringfile('0') do
      print string("#{twit.text}")
    end
    sign.stringfile('1') do
      print string("(#{twit.user.name})").red
    end
  }.write!
end
__END__

My favorite part is that I use the script for its own database. It keeps appending twitter ids it has seen to the end of the file.

Trackbacks

Use this link to trackback from your own site.

Comments

Leave a response

  1. Geoffrey Grosenbach Fri, 22 Feb 2008 23:51:42 UTC

    Code that appends to its own file? Very why-esque!

  2. Pierro Sat, 23 Feb 2008 23:51:09 UTC

    Howdy;

    Sounds great. Pard for my badly english, my german is better, anyway i will start a small question

    How can i use it, if im not a big coding nose ??

  3. jackie Sun, 24 Feb 2008 06:18:53 UTC

    nerd.

  4. [...] my Twitterbrite post? Well I registered twitterbrite.com, and now if my client catches a twit from you, it records [...]

  5. charles Tue, 15 Jul 2008 16:41:08 UTC

    whould like to use something like this for a twitter that i am fallowing

Comments

Check Spelling
Activate Spell Check while Typing