Skip to content

Instantly share code, notes, and snippets.

View asadawan's full-sized avatar

Asad Awan asadawan

  • San Francisco
  • 16:57 (UTC -07:00)
View GitHub Profile
@asadawan
asadawan / overrideChangePage.js
Created July 26, 2011 06:53
Hack to override the the changePage handler in jQuery Mobile, so data can be passed to the "page" using a "__" in the data-url and appending the data to be passed after this delimiter. The nice part of this is that the resulting url can be used to bookmar
// Copyright: Asad Awan
// license: Apache
var utils: {
overrideChangePage: function() {
var cp = $.mobile.changePage;
$.mobile.changePage = function(url, opts) {
if (typeof(url) == 'string') {
var o = url.split('#');
if (o.length == 2) {
@asadawan
asadawan / handler.py
Created July 13, 2011 18:18
A base view handler for djano projects. Gives lots of utils and lets you use classes for handling views. It also extracts query parms from requests to args saving you on lots of if-conditions in the view code.
'''
@author: asad k awan
@copyright: asad k awan
@license: Apache
'''
import re
from django.http import HttpResponse, HttpResponseBadRequest
from django.db.models.query import QuerySet
@asadawan
asadawan / pyser.py
Created July 13, 2011 18:11
A Serializer on top of djano serializer that handels list fields (from djano non-rel)
"""
@author: Asad K Awan
@copyright: Asad K Awan
@license: BSD
"""
from django.core.serializers.python import Serializer as PySerializer
@asadawan
asadawan / runDocTests.py
Created January 7, 2011 09:18
Run doctests in django environment for any given file or files in a directory
#! /usr/bin/env python -Wall
"""
Run doctests from a given set of modules in django environment.
@author: Asad
@license: BSD
"""
import os, sys, glob
from sys import stderr