Manipulating list of tweets with TextMate (with screencast)

I have begun tweeting at conferences where it is appropriate and feasible. It serves multiple purposes, providing me a way of reflecting on what is being said, as a back-channel with other conference attendees, and to share some of what is happening with the outside world. Although 140 characters is obviously very short, I have often appreciated the little snippets of information coming out of conferences that I could not attend – at a minimum, it might inspire you to go check out people’s blogs, Slideshare presentations or video/audio recordings, etc.

After having tweeted intensively for a few days, I thus have bunch of tweets with the same hashtag. A few times in the past, I’ve made a blog post with all my tweets for a given conference. Again, I am not sure how useful that is to others – but it is very easy to do, and it provides a quick reference for myself in the future.

There might be several ways of doing this, but for me, I start by doing a search for #hashtag from:houshuang, with 50 hits per page. I then copy each page (Ctrl+A, Ctrl+C) to TextMate. Now, there are many lines that we do not want, the easiest is to apply a text filter, select Text…Filtering…Copy Matching Lines Into New Document, and use the search query #hashtag – each line containing the hashtag should be a tweet, and each tweet should contain this hashtag, since that is what we searched for. This way we get rid of all the “Welcome to Twitter”, etc lines.

I also whipped up two one-line Ruby programs, that perform simple tasks. The first one, strip, removes all leading and trailing white space (there is already a command that removes trailing white space only, it users Perl. I could have used Perl for this one as well, but I feel more comfortable in Ruby):

File.read(ARGV[0]).each {|l| puts l.strip}

And a quick program that reverses the order of the lines (so that we get the first tweets first, instead of last):

puts File.read(ARGV[0]).split("\n").reverse.join("\n")

I’ve created a screencast to show how it all comes together (note, there are many other ways of accomplishing this task, but I wanted to show an example of how easy and powerful it is to use regexps, and write small snippets for TextMate). Watch screencast (eleven minutes, QuickTime). And see the post that was the result of this process.

Stian

Similar posts that might interest you:

3 Responses to “Manipulating list of tweets with TextMate (with screencast)”

  1. Tweets from Hewlett’s OER Grantees’ meeting at Yale | Random Stuff that Matters
    April 12th, 2010 @ 7:38 am

    [...] here is a list of the tweets I sent out before, during, and after the conference. I also wrote a blog post with a screencast about how I generated and formatted this list, using Ruby, TextMate and regular [...]

  2. Chris
    April 13th, 2010 @ 2:20 pm

    You might want to install the twitter gem (sudo gem install twitter) and then try something like:

    #!/usr/bin/env ruby
    require 'rubygems'
    gem 'twitter'
    require 'twitter'

    Twitter::Search.new('#oerhf').from('houshuang').each do |r|
    puts r.created_at, r.text
    end

  3. Tweets from Learning Analytics conference 2011 | Random Stuff that Matters
    March 4th, 2011 @ 1:17 am

    [...] more in the Etherpad later – at the end I wasn’t writing much of anything. I made a screencast of one way of preparing these [...]

Leave a Reply