Skip to content

Instantly share code, notes, and snippets.

# Allow the metal piece to run in isolation
require(File.dirname(__FILE__) + "/../../config/environment") unless defined?(Rails)
class Pulse < Rails::Rack::Metal
def call(env)
if env["PATH_INFO"] =~ /^\/heartbeat/
[200, {"Content-Type" => "text/html"}, (1..10).to_a.to_sentence]
else
super
end
# Allow the metal piece to run in isolation
require(File.dirname(__FILE__) + "/../../config/environment") unless defined?(Rails)
class RackRoll < Rails::Rack::Metal
def call(env)
[ 302, {'Location'=> 'http://www.youtube.com/watch?v=oHg5SJYRHA0' }, [] ]
end
end
diff --git a/ext/extconf.rb b/ext/extconf.rb
index c959833..241ea67 100644
--- a/ext/extconf.rb
+++ b/ext/extconf.rb
@@ -1,13 +1,13 @@
# windows compatibility, need different library name
-if(PLATFORM =~ /mingw|mswin/) then
+if(RUBY_PLATFORM =~ /mingw|mswin/) then
# SUPER DARING APP TEMPLATE 1.0
# By Peter Cooper
# Link to local copy of edge rails
inside('vendor') { run 'ln -s ~/dev/rails/rails rails' }
# Delete unnecessary files
run "rm README"
run "rm public/index.html"
run "rm public/favicon.ico"
module ActiveRecord::ConnectionAdapters
class PostgreSQLAdapter < AbstractAdapter
def client_min_messages=(level)
@logger.silence do
execute("SET client_min_messages TO '#{level}'")
end
end
end
end
End Result: What are the Lat/Lng points for zipcode 60614's boundaries in chicago
I downloaded the shapefile from here
http://egov.cityofchicago.org:80/webportal/COCWebPortal/COC_ATTACH/zipcodes.zip
This page gave me directions on where to find the SRID
http://egov.cityofchicago.org:80/webportal/COCWebPortal/COC_ATTACH/Chicago_GIS_Addressing_Stds_May_19.pdf
1 Technical Mapping Specifications
Given a preexisting lat/lng
lat | 41.9219
lng | -87.6562
and a table that I added a geometry column via the following sql
SELECT AddGeometryColumn('bars','the_geom','9102671','MULTILINESTRING',2);
(the srid is illinois, east, 9102671)
(i think lat-lngs will be stored as multistring)
require "#{File.dirname(__FILE__)}/../vendor/bundler_gems/environment"
class Rails::Boot
def run
load_initializer
extend_environment
Rails::Initializer.run(:set_load_path)
end
def extend_environment
@samgranieri
samgranieri / .gitignore
Created January 29, 2010 04:55
Rails 3 Capistrano Notes
db/*.sqlite3
log/*.log
tmp/**/*
bin/*
vendor/gems/ruby/1.8/*
!vendor/gems/ruby/1.8/cache/
[git:master] % gem bundle --backtrace
ERROR: While executing gem ... (NoMethodError)
undefined method `path' for #<Bundler::Dsl:0x1018d0908>
/Users/sam/Documents/Development/ruby/rails/Gemfile:1:in `evaluate'
/Users/sam/ree/lib/ruby/gems/1.8/gems/bundler-0.8.1/lib/bundler/bundle.rb:33:in `initialize'
/Users/sam/ree/lib/ruby/gems/1.8/gems/bundler-0.8.1/lib/bundler/bundle.rb:14:in `new'
/Users/sam/ree/lib/ruby/gems/1.8/gems/bundler-0.8.1/lib/bundler/bundle.rb:14:in `load'
/Users/sam/ree/lib/ruby/gems/1.8/gems/bundler-0.8.1/lib/bundler/cli.rb:36:in `initialize'
/Users/sam/ree/lib/ruby/gems/1.8/gems/bundler-0.8.1/lib/bundler/cli.rb:6:in `new'
/Users/sam/ree/lib/ruby/gems/1.8/gems/bundler-0.8.1/lib/bundler/cli.rb:6:in `run'