Skip to content

Instantly share code, notes, and snippets.

View pstengel's full-sized avatar

Paul Stengel pstengel

View GitHub Profile
#!/usr/local/bin/ruby
require "open-uri"
require "json"
open("http://api.wunderground.com/api/AP_KEY/conditions/bestfct:1/q/pws:KNYSCHEN27.json") do |f|
now = JSON.parse(f.read)["current_observation"]
forecast = now.values_at(*%w(weather temp_f relative_humidity wind_mph feelslike_f))
forecast.map! { |f| f.respond_to?(:downcase) ? f.downcase : f }