Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Pavel Katsev p7k

🏠
Working from home
View GitHub Profile
@p7k
p7k / install_postgis_osx.sh
Created Aug 4, 2011 — forked from juniorz/install_postgis_osx.sh
Installing PostGIS on Mac OS X and Ubuntu
View install_postgis_osx.sh
# Some good references are:
# http://russbrooks.com/2010/11/25/install-postgresql-9-on-os-x
# http://www.paolocorti.net/2008/01/30/installing-postgis-on-ubuntu/
# http://postgis.refractions.net/documentation/manual-1.5/ch02.html#id2630392
#1. Install PostgreSQL postgis and postgres
brew install postgis
initdb /usr/local/var/postgres
pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start
View gist:945012
elif isinstance(value, (int, long)):
model = self.fk_resource._meta.object_class
try:
obj = model.objects.get(pk=value)
except (model.DoesNotExist, model.MultipleObjectsReturned):
raise ApiFieldError("Could not find the provided object via PK '%s'." % value)
else:
return self.fk_resource.full_dehydrate(obj)
View gist:838884
def parse_event(self, response):
# self.log('Hi, this is an event page! %s' % response.url)
hxs = HtmlXPathSelector(response)
event_view_div = hxs.select('//div[@class="event_view"]')
event = Event()
event_loader = XPathItemLoader(event, event_view_div)
event_loader.add_value('source', self.name)