Skip to content

Instantly share code, notes, and snippets.

View benaskins's full-sized avatar
🍑
Peachy

Ben Askins benaskins

🍑
Peachy
View GitHub Profile
export dev=~/Development
export cp=$dev/client_projects
# Quick links to client projects
for DIR in `ls $cp`
do
export $DIR=$cp/$DIR
done
<?xml version="1.0" encoding="iso-8859-1" ?>
<data>
<metadata>
<sector>weather</sector>
<title>Weatherzone</title>
<provider>The Weather Company</provider>
<provider_url>http://www.theweather.com.au</provider_url>
<schema>twcwx.dtd</schema>
<version>1.80</version>
<create_time tz="EDT">2009-05-11T11:39:02</create_time>
postcodes = FasterCSV.read(data_source_for("postcodes.csv"))
postcodes.each do |(post_code, name, state_name, _, _, _, _, _, _, category)|
if category.squish == "Delivery Area"
post_code = sprintf("%04d", post_code.to_i)
state = State.find_or_create_by_name(state_name)
Locality.create(:post_code => post_code, :name => name, :state => state)
end
end
module Locality::Search
def self.included(base)
base.class_eval do
class << self
def search(criteria)
logger.debug("search")
results = find_all_by_name(criteria)
if results.empty?
WEATHER_FINDER_OPTIONS = {
:include => [:forecasts, :conditions, :point_forecasts, :uv_index, :sun, :moon, :warnings, :district_forecasts, :marine_forecast, :moon_phases, :news_items,
:historical_observations, :daily_observations, :position, :almanac, :radar_animator, :radar_still, :satellite_animator, :satellite_still, :links],
:image => {:type => "syn", :size => "640x480", :days => 0},
:days => 7
}
Weather.find_by_location_name("#{location_name} #{state}", WEATHER_FINDER_OPTIONS)
~ $ gem list passenger
*** LOCAL GEMS ***
passenger (2.2.3)
~ $ locate passenger-install-apache2-module
/Library/Ruby/Gems/1.8/gems/passenger-2.0.3/bin/passenger-install-apache2-module
/usr/bin/passenger-install-apache2-module
~ $ sudo passenger-install-apache2-module
/usr/bin/passenger-install-apache2-module:19:in `load': no such file to load -- passenger-install-apache2-module (LoadError)
~ $ sudo gem uninstall passenger
Password:
Remove executables:
passenger-spawn-server, passenger-install-apache2-module, passenger-install-nginx-module, passenger-config, passenger-memory-stats, passenger-make-enterprisey, passenger-status, passenger-stress-test
in addition to the gem? [Yn] Y
Removing passenger-spawn-server
Removing passenger-install-apache2-module
Removing passenger-install-nginx-module
Removing passenger-config
~ $ gem sources -c
*** Removed specs cache ***
*** Removed user source cache ***
*** Removed latest user source cache ***
*** Removed system source cache ***
*** Removed latest system source cache ***
~ $ gem list passenger
*** LOCAL GEMS ***
~ $ gem env
RubyGems Environment:
- RUBYGEMS VERSION: 1.3.1
- RUBY VERSION: 1.8.6 (2008-08-11 patchlevel 287) [universal-darwin9.0]
- INSTALLATION DIRECTORY: /Library/Ruby/Gems/1.8
- RUBY EXECUTABLE: /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
- EXECUTABLE DIRECTORY: /usr/bin
- RUBYGEMS PLATFORMS:
- ruby
- universal-darwin-9
[7, 16] in /home/weatherzone/apps/wzfb-staging/releases/20090619001435/app/controllers/weather_controller.rb
7 :days => 7
8 }.freeze
9
10 def show
11 debugger()
=> 12 @weather = weather_for(params[:location_name], params[:state])
13 @location = @weather.countries.first.locations.first
14 @location_forecast = @location.current_forecast
15 end