Skip to content

Instantly share code, notes, and snippets.

def match(pattern,text):
if pattern[0] == '^':
return match_here(pattern[1:], text)
if match_here(pattern,text):
return 1
while text:
if match_here(pattern,text):
return 1
def add_preview_for(*fields):
"""
This is a decorator for model classes that adds preview methods.
So instead of manually adding preview methods:
>>> class Student(models.Model):
... photo = models.ImageField()
... icon = models.ImageField()
...
@shamrin
shamrin / gauge.js
Last active August 29, 2015 14:00 — forked from tomerd/gauge.js
function Gauge(placeholderName, configuration)
{
this.placeholderName = placeholderName;
var self = this; // for internal d3 functions
this.configure = function(configuration)
{
this.config = configuration;
#!/bin/sh
git filter-branch --env-filter '
an="$GIT_AUTHOR_NAME"
am="$GIT_AUTHOR_EMAIL"
cn="$GIT_COMMITTER_NAME"
cm="$GIT_COMMITTER_EMAIL"
if [ "$GIT_COMMITTER_EMAIL" = "root@ubuntu.(none)" ]