Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save djones/126885 to your computer and use it in GitHub Desktop.
Save djones/126885 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
require 'rubygems'
require 'hpricot'
require 'open-uri'
query = "//table//table//table//td/font/b"
html_doc = Hpricot(open("http://www.ccc.govt.nz/weatherdata/waterweb.htm")).search(query)
temperature = html_doc[0].inner_html.to_f
windchill = html_doc[1].inner_html.to_f
message = "It is #{temperature} degrees outside in Christchurch with a windchill of #{windchill} degrees"
puts message
`say #{message}`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment