Skip to content

Instantly share code, notes, and snippets.

View bergantine's full-sized avatar

J*Bergantine bergantine

  • London, United Kingdom
View GitHub Profile
@insin
insin / bash_prompt.sh
Created December 3, 2011 01:49 — forked from woods/git_svn_bash_prompt.sh
Set color bash prompt according to active virtualenv, git branch and return status of last command.
#!/bin/bash
#
# DESCRIPTION:
#
# Set the bash prompt according to:
# * the active virtualenv
# * the branch/status of the current git repository
# * the return value of the previous command
# * the fact you just came from Windows and are used to having newlines in
# your prompts.
@leah
leah / json-response.py
Created October 5, 2011 19:08
JSONResponse classes
import re
import simplejson
from django.http import HttpResponse
from django.conf import settings
class JSONResponse(HttpResponse):
def __init__(self, request, data):
indent = 2 if settings.DEBUG else None
@carljm
carljm / postactivate
Created July 12, 2011 18:21
Yo dawg, I heard you like Ruby...
#!/bin/bash
# This hook is run after every virtualenv is activated.
export OLD_GEM_HOME=$GEM_HOME
export GEM_HOME=$VIRTUAL_ENV/gems/
export GEM_PATH=
export PATH=$VIRTUAL_ENV/gems/bin:$PATH
anonymous
anonymous / simplegeo-context-neighborhoods-by-city.py
Created July 5, 2011 22:54
Find all neighborhoods in a given city, by address
>>> import simplegeo
>>> from itertools import ifilter
>>> client = simplegeo.context.Client('your-key','your-secret')
>>> location = client.get_context_by_address("41 Decatur St, San Francisco, CA")
# Find the bounding box of your current city
>>> sf = next(ifilter(lambda feature: feature['classifiers'][0]['category'] == 'Administrative', location['features']), None)
>>> hoods = client.get_features_from_bbox(sf['bounds'], features__category='Neighborhood')
@mwbrooks
mwbrooks / projectAppDelegate.m
Created February 15, 2011 18:43
ON PhoneGap-iOS, open external links in the external browser (Safari.app)
/**
* Note: the following function should already exist in your application delegate file.
* Replace it with the following implementation.
*
* Thanks to @purplecabbage for implementation.
* Thanks to Ruddiger for the iFrame patch.
*/
// ...
"""
jQuery templates use constructs like:
{{if condition}} print something{{/if}}
This, of course, completely screws up Django templates,
because Django thinks {{ and }} mean something.
Wrap {% verbatim %} and {% endverbatim %} around those
blocks of jQuery templates and this will try its best