Rails says "RoR!"

taming the animal.

twitplot.com twitplot twit plot twitter “twitter api” “twitter gem” “twitter ruby gem” jnunemaker geokit “geokit rails”

TwitPlot.com my twitter testing ground

Rails

Going to spare you the obligatory 5 paragraph ‘I haven’t posted in months’ intro. So, my new project has been figuring out how to condense this business of twitter into something people can understand and find useful.

So I bought http://twitplot.com yesterday, grabbed the pretty well done twitter gem http://github.com/jnunemaker/twitter/ and started playing with the public search api.

What I’ve gotten out of it is a way to see what people are saying about any keyword (or idea really) anywhere in the world (or at least anywhere that I can geocode using a hacked version of GeoKit http://geokit.rubyforge.org/).

Some useful things I’ve done in the app that I’d like to share are how I’ve captured urls and user names in a “tweet” and added the markup so you can click on them. The regex was pretty easy, check it out:


def add_url_markup(text)
urls = []
users =[]
# find urls
text.split.each{|a| a=~/(http\:\/\/\S+)/; urls << $1}
# find twitter usernames (@someusername)
text.split.each{|a| a=~/(\@\S+)/; users << $1}
# add markup
users.compact.each{|user| text.gsub!(user, "#{user}")}
urls.compact.each{|url| text.gsub!(url, "#{url}")}
return text
end

view this code at gist.github.com


So check twitplot.com out play with it let me know what you think.

January 13, 2009January 13, 2009 TylerMontgomery Tagged twitplot.com twitplot twit plot twitter "twitter api" "twitter gem" "twitter ruby gem" jnunemaker geokit "geokit rails" Leave a comment
Widgets

Tags

Design Linux Music Rails Ruby Uncategorized Windows

Calendar

March 2023
M T W T F S S
 12345
6789101112
13141516171819
20212223242526
2728293031  
« Apr    

Awesomerails Hits:

  • 153,227 hits
Blog at WordPress.com.
Privacy & Cookies: This site uses cookies. By continuing to use this website, you agree to their use.
To find out more, including how to control cookies, see here: Cookie Policy
  • Follow Following
    • Rails says "RoR!"
    • Already have a WordPress.com account? Log in now.
    • Rails says "RoR!"
    • Customize
    • Follow Following
    • Sign up
    • Log in
    • Report this content
    • View site in Reader
    • Manage subscriptions
    • Collapse this bar