Skip to content

Instantly share code, notes, and snippets.

View graybill's full-sized avatar

Linus Graybill graybill

  • Philadelphia, PA
View GitHub Profile
# we should be running psql in dev since heroku does.
default: &DEFAULT
adapter: postgresql
encoding: utf8
min_messages: warning
development:
<<: *DEFAULT
database: tedx_dev
test:
<<: *DEFAULT
# Returns sorted array of types of items that there are changes for.
def change_item_types
return ActiveRecord::Base.connection.select_values('SELECT DISTINCT(item_type) FROM versions ORDER BY LOWER(item_type)')
end
19:17 admin@meatball: ~/.kegbot
> pip install PIL
Downloading/unpacking PIL
Downloading PIL-1.1.7.tar.gz (506Kb): 506Kb downloaded
Running setup.py egg_info for package PIL
Installing collected packages: PIL
Running setup.py install for PIL
--- using frameworks at /System/Library/Frameworks
building '_imaging' extension
gcc-4.2 -fno-strict-aliasing -fno-common -dynamic -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch i386 -arch ppc -arch x86_64 -pipe -DHAVE_LIBJPEG -DHAVE_LIBZ -I/System/Library/Frameworks/Tcl.framework/Headers -I/System/Library/Frameworks/Tk.framework/Headers -IlibImaging -I/System/Library/Frameworks/Python.framework/Versions/2.6/include -I/usr/local/include -I/usr/include -I/System/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6 -c _imaging.c -o build/temp.macosx-10.6-universal-2.6/_imaging.o
> python -c 'import sys; print "\n".join(["%s %s" % (i, v) for i, v in enumerate(sys.path)])'
0
1 /Library/Python/2.6/site-packages/pip-1.0.1-py2.6.egg
2 /System/Library/Frameworks/Python.framework/Versions/2.6/lib/python26.zip
3 /System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6
4 /System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/plat-darwin
5 /System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/plat-mac
6 /System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/plat-mac/lib-scriptpackages
7 /System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python
8 /System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-tk
19:14 admin@meatball: ~/.kegbot [1]
> kegbot-admin.py runserver
Validating models...
Unhandled exception in thread started by <bound method Command.inner_run of <django.core.management.commands.runserver.Command object at 0x10110b550>>
Traceback (most recent call last):
File "/Library/Python/2.6/site-packages/django/core/management/commands/runserver.py", line 88, in inner_run
self.validate(display_num_errors=True)
File "/Library/Python/2.6/site-packages/django/core/management/base.py", line 249, in validate
num_errors = get_validation_errors(s, app)
{
"address1":"Love Park",
"address2":"",
"byob":false,
"cash_only":false,
"city":"Philadelphia",
"debug":
[
],
class Location
include MongoMapper::Document
scope :restaurants, where(:loc_type => 'restaurant')
scope :bars, where(:loc_type => 'bar')
scope :trucks, where(:loc_type => 'truck')
key :name, String, :required => true
key :store_no, Integer
key :address1, String
def self.coordinates(addr)
include Geokit::Geocoders
res=MultiGeocoder.geocode(addr)
r = res.ll.split(',')
[r[0].to_f, r[1].to_f]
end
def self.create(params = nil)
loc = coordinates(params[:address1] + "+PA+" + params[:zipcode])
super
require 'csv'
def coordinates(addr)
include Geokit::Geocoders
res=MultiGeocoder.geocode(addr)
res.ll
end
namespace :import do
desc 'Parse CSV files and import into the database'
@graybill
graybill / gitconfig
Created April 5, 2011 20:12
gitconfig
[alias]
co = checkout
ci = commit
st = status
pu = push
pl = pull
pub = "!f() { git push ${1:-origin} `git symbolic-ref HEAD`; }; f"
[user]
email = [email protected]
name = Linus Graybill