I hereby claim:
- I am ashchristopher on github.
- I am ashchristopher (https://keybase.io/ashchristopher) on keybase.
- I have a public key whose fingerprint is 4479 24F8 BAB0 4C22 34EF 776C 8BE8 BEDB C5B4 0CC5
To claim this, I am signing this object:
from django import forms | |
CHOICES = ( | |
('1', 1), | |
('2', 2), | |
('3', 3), | |
('4', 4), | |
('5', 5), | |
) |
import gc | |
def queryset_iterator(queryset, chunksize=1000): | |
""" | |
Iterate over a Django Queryset ordered by the primary key | |
This method loads a maximum of chunksize (default: 1000) rows in it's | |
memory at the same time while django normally would load all rows in it's | |
memory. Using the iterator() method only causes it to not preload all the | |
classes. |
class BaseRouter(object): | |
""" | |
Base class for routers allowing several apps to be grouped in a shard group. | |
Subclasses need to define a list of app names and a prefix for the db names of the shard group. | |
e.g., | |
app_list = ('my_app1', ) | |
db_names_prefix = 'my_shard_' | |
""" | |
app_list = tuple() |
I hereby claim:
To claim this, I am signing this object:
In [1]: def monkey_patch(): | |
...: return u"This is a monkey patch!" | |
...: | |
In [2]: import uuid | |
In [3]: print uuid.uuid4() | |
dda44145-8555-44c8-a9eb-e7337ee94437 | |
In [4]: uuid.uuid4 = monkey_patch |
def _track_event(event_name, identity_user_id, event_id, **kwargs): | |
EventTracker.track('api', 'hook.processed', data={ | |
'event': event_name, | |
'identity_user_id': identity_user_id, | |
'event_id': event_id, | |
}) | |
@receiver(hook_event_received, dispatch_uid='hooks.models.track_event') | |
def track_event(event_name, identity_user_id, event_id, **kwargs): |
#!/bin/sh | |
setup_brew () { | |
if ![-f "/usr/local/bin/brew"]; then | |
/usr/bin/ruby -e "$(/usr/bin/curl -fsSL https://raw.github.com/mxcl/homebrew/master/Library/Contributions/install_homebrew.rb)" | |
fi | |
} | |
setup_ipython () { | |
brew install readline |
import urls | |
def show_urls(urllist, depth=0): | |
for entry in urllist: | |
print " " * depth, entry.regex.pattern | |
if hasattr(entry, 'url_patterns'): | |
show_urls(entry.url_patterns, depth + 1) | |
show_urls(urls.urlpatterns) |
from django.db import models | |
from django.utils.functional import Promise | |
from django.utils.encoding import force_unicode | |
from django.utils import simplejson as json | |
from decimal import Decimal | |
from django.core import serializers | |
from django.conf import settings | |
from django.http import HttpResponse, HttpResponseForbidden, Http404 | |
from django.core.mail import mail_admins | |
from django.db.models.query import QuerySet |