Skip to content

Instantly share code, notes, and snippets.

@stevenocchipinti
Created January 20, 2012 03:37
Show Gist options
  • Save stevenocchipinti/1644819 to your computer and use it in GitHub Desktop.
Save stevenocchipinti/1644819 to your computer and use it in GitHub Desktop.
Tramtracker
#!/usr/bin/env ruby
require 'open-uri'
unless ARGV[0]
puts "Usage: #{$0} <stop-id>"
exit 0
end
# Configuration
url = "http://www.tramtracker.com.au/?id=#{ARGV[0]}"
regex = /\d*\) Rte (\d*)<br>\r\n(\d*)/
open(url).read.scan(regex) do |matches|
puts "Route #{matches[0]} arriving in #{matches[1]} minutes"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment