Skip to content

Instantly share code, notes, and snippets.

@pgib
Created November 10, 2011 23:58
Show Gist options
  • Save pgib/1356679 to your computer and use it in GitHub Desktop.
Save pgib/1356679 to your computer and use it in GitHub Desktop.
Get me some temperatures for screen's backtick!
#!/usr/bin/env ruby
# encoding: UTF-8
require 'rubygems'
# https://github.com/jnunemaker/google-weather/
# gem install google-weather
require 'google_weather'
# usage: outside_temp.rb [City,Province|Postal Code]
if ARGV.size == 0
city = "Vancouver,BC"
else
city = ARGV[0]
end
weather = GoogleWeather.new(city)
# I'd like to append ℃ or °, but screen seems to mangle Unicode?
puts "#{weather.current_conditions.temp_c}C"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment