Skip to content

Instantly share code, notes, and snippets.

View pilt's full-sized avatar

Simon Pantzare pilt

View GitHub Profile
@pilt
pilt / Gemfile
Created July 30, 2011 12:46
Incorporating Jammit with Django
source "http://rubygems.org"
gem "jammit"
gem "closure-compiler"
multipled = [3 * s for s in series]
coach_models = [
(health.models.HealthMessage, health.search_indexes.HealthMessageIndex),
(django.contrib.auth.models.User, health.search_indexes.UserIndex),
]
coach_site = haystack.sites.SearchSite()
coach_indexes = {}
def setup_signals(model):
index = coach_site.get_index(model)
# deb cdrom:[Ubuntu 10.10 _Maverick Meerkat_ - Release amd64 (20101007)]/ maverick main restricted
# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://se.archive.ubuntu.com/ubuntu/ natty main restricted
deb-src http://se.archive.ubuntu.com/ubuntu/ natty main restricted
## Major bug fix updates produced after the final release of the
## distribution.
deb http://se.archive.ubuntu.com/ubuntu/ natty-updates main restricted
2 gustaf
3 henke
1 pontus
class Foo(object):
def to_json(self):
return json.dumps(self, cls=MongoEncoder)
plans: [{id: 1, ...}, {id: 2, ...}]
meals: [{plan: 1, ...}, {plan: 1, ...}]
workouts: [{plan: 1, ...}, {plan: 1, ...}]
istället för
plans: [{id: 1, meals: [...], workouts: [...]}, ...]
$ java -version
java version "1.6.0_29"
Java(TM) SE Runtime Environment (build 1.6.0_29-b11-402-11D50b)
Java HotSpot(TM) 64-Bit Server VM (build 20.4-b02-402, mixed mode)
urlpatterns = pattern('physiology.views',
menu('phys_and_medication',
submenu('medicine', url(r'^medicine/$', ...)),
submenu('phys', url(r'^something/$', ...)),
submenu('phys', url(r'^something-else/$', ...)),
),
)
def unpacked(callback):
"""Decorator to unpack responses before passing the result to a callback.
"""
@functools.wraps(callback)
@tornado.stack_context.wrap
def unpacking_callback(response):
callback(mdp.unpack_response(response))
return unpacking_callback