Don't Miss the CalTrain
I have a bad track record of getting to the CalTrain stop on time. It's a very depressed experience to see the train receding into the distance as I race around the curve to the train stop on my bike. It's even more depressing to instead see the train loading, sprint down the stairs, under the track, and back up the other side (all the while carrying my bike rather than riding down the ramp), and get close enough to touch the train as the conductor closes the doors before I can get in and then watch the train recede into the distance as I stand there panting.
It's clear that the CalTrain expects us to always be on time and shows no quarter. Why? Well because the CalTrain is always on time. Isn't it? Actually, no, it's not. For one reason or another, the CalTrain can be as much as an hour late, full, or even canceled.
As passengers, we need to be prepared and in the know. So far, the best resources I've found for being on time and keeping tabs on CalTrain delays are a clock and twitter.com.
The programmer in me hates manual labor, so I decided to automate a little system to help me out. It comes in two parts,
- A script to (a) check twitter for tweets @caltrain and (b) make my computer speak and pop up a dialog box with the tweets reminding me to pack up and go catch the train
- A schedule to run the script at the same time every day, just in time to catch the train
The script itself comes in two parts, AppleScript and Ruby. The AppleScript to hook into my Finder app for the dialog box. The Ruby to parse Twitter's API so that I don't have to do it in AppleScript (shudder).
I've posted the scripts up on github.
The following pages helped me out:
Ruby JSON - http://flori.github.com/json/
Twitter Search - http://search.twitter.com/api/
AppleScript - http://www.tee-boy.com/forums/viewtopic.php?f=8&t=76
Comments