Skip to content

Instantly share code, notes, and snippets.

@flyingoctopus
Forked from pgib/outside_temp.rb
Created November 11, 2011 01:19
Show Gist options
  • Save flyingoctopus/1356843 to your computer and use it in GitHub Desktop.
Save flyingoctopus/1356843 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"
@flyingoctopus
Copy link
Author

beautiful!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment