Skip to content

Instantly share code, notes, and snippets.

@jorilallo
jorilallo / json-response.py
Created February 2, 2012 02:20 — forked from leah/json-response.py
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
@jorilallo
jorilallo / json-response.py
Created October 17, 2011 22:51 — forked from leah/json-response.py
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
@jorilallo
jorilallo / urls.py
Created September 23, 2011 17:04 — forked from sjl/urls.py
Monkeypatch the Celery admin to show a column for task run time in the list view.
# Put this in your urls.py file after the admin.autodiscover() line.
# ---------------------------------------------------------------------------------
# Monkeypatch the Celery admin to show a column for task run time in the list view.
from djcelery.admin import TaskMonitor
from djcelery.models import TaskState
admin.site.unregister([TaskState])
TaskMonitor.list_display += ('runtime',)
admin.site.register(TaskState, TaskMonitor)
@jorilallo
jorilallo / grove.io.js
Created August 25, 2011 17:37 — forked from defunkt/grove.io.js
grove.io dotjs script for inlining images
setInterval(function(){
$('.content a').each(function() {
if (/\.(gif|jpe?g|png)/i.test($(this).text()))
$(this).html('<img src="'+$(this).text()+'"/>')
})
}, 1000)
@jorilallo
jorilallo / hr.less
Created July 11, 2011 18:51 — forked from maccman/hr.less
HR CSS3 Tapering
/* See http://cl.ly/8KmQ for an example */
hr {
margin: 15px 0;
position: relative;
border: 1px solid transparent;
.box-shadow(0, 1px, 2px, rgba(0,0,0,0.3));
&:before, &:after {
content: "";
//this is a generic function which should be moved to a Baseclass of Backbone or a Backbone extension
autoBind =
{
autoBind: function () {
var self = this;
var funcs = _.functions(this.constructor.prototype);
var protoFuncs = ['autoBind', 'constructor'].concat(
_.functions(Backbone.Collection.prototype),
_.functions(Backbone.Model.prototype),
_.functions(Backbone.View.prototype));