Skip to content

Instantly share code, notes, and snippets.

@g00fy-
g00fy- / gist:5027167
Created February 25, 2013 03:00
lazyAttr helper for emberjs style template bindings (draft)
LazyAttribute = function(attribute,context){
this.attribute = attribute;
this.context = context;
this.id = _.uniqueId('h');
this.bindEvents();
};
LazyAttribute.prototype.bindEvents = function(){
this.context.on('change:'+this.attribute.split('.')[0],this.update,this);
};
@g00fy-
g00fy- / IndexedDB.setVersionShim.js
Created October 13, 2012 20:14 — forked from axemclion/IndexedDB.setVersionShim.js
Shim that converts Chrome's SetVersion to the standard IndexedDB onupgradeneeded events
////////////////////////////////////////////////////////////////////////////////////////////////////
var openReqShim = function(dbName, version){
var me = this;
var IDBRequest = function(){
this.onsuccess = this.onerror = this.onblocked = this.onupgradeneeded = null;
};
function copyReq(req){
req = req || dbOpenReq;
@g00fy-
g00fy- / RESTMiddleware.py
Created August 22, 2011 00:54
Simple Django Middleware for handling Form & Multipart Form PUT & DELETE methods AKA REST (GET,POST,PUT,DELETE)
from django.http import QueryDict
from django.http.multipartparser import MultiValueDict
class RESTMiddleware(object):
def process_request(self,request):
request.PUT=QueryDict('')
request.DELETE = QueryDict('')
method = request.META.get('REQUEST_METHOD','').upper() #upper ? rly?
if method == 'PUT':
self.handle_PUT(request)