This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
USER=%(user)s | |
NAME=celeryd | |
VIRTUALENV=%(virtualenv_dir)s | |
PROJECT_ROOT=%(project_root)s | |
DAEMON=$VIRTUALENV/bin/celeryd | |
PIDFILE=$PROJECT_ROOT/$NAME.pid | |
LOGFILE=$PROJECT_ROOT/$NAME.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
from django.db import models | |
from django.core.cache import cache | |
class CacheManager(models.Manager): | |
'''Generic Cache Manager based on the concept of generator ids to | |
handle invalidation of collections. | |
''' | |
def _test_model(self, obj): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import os | |
import sys | |
import subprocess | |
def simplify_pg_index_line(line): | |
""" | |
Given a postgres index file line returns it's simplified form. | |
Returns None for comments |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
from contextlib import contextmanager | |
@contextmanager | |
def easyprofile(msg): | |
before = time.time() | |
yield | |
print '%s took %0.2fsec' % (msg, time.time() - before) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Creating UITableView Cell | |
// Transparent UIWebView | |
CGRect cellFrame = CGRectMake(0, 0, 320, 100); | |
cell = [[[UITableViewCell alloc] initWithFrame:cellFrame] autorelease]; | |
CGRect labelFrame = CGRectMake(5,5,310,90); | |
UIWebView *textWebView = [[[UIWebView alloc] initWithFrame:labelFrame] autorelease]; | |
textWebView.backgroundColor = [UIColor clearColor]; | |
[textWebView setOpaque:NO]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# An example of the below | |
virtualenv "/home/dvcsmirrors/hg" do | |
owner "root" | |
group "dvcsmirrors" | |
mode 0775 | |
packages "Mercurial" => "1.6.3", | |
"hgsubversion" => "1.1.2" | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 00 prepended to filename so this shows up first in the list of gists. | |
import socket | |
import time | |
import simplejson | |
from django.conf import settings | |
def log_event(logger, event, request=None, data=None, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Straight Include template tag by @HenrikJoreteg | |
Django templates don't give us any way to escape template tags. | |
So if you ever need to include client side templates for ICanHaz.js (or anything else that | |
may confuse django's templating engine) You can is this little snippet. | |
Just use it as you would a normal {% include %} tag. It just won't process the included text. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Class that can help django-piston process multiple types of authentication | |
# Example usage: | |
# | |
# from piston.authentication import HttpBasicAuthentication | |
# from somewhere import OtherCustomAuthModule | |
# | |
# httpAuth = HttpBasicAuthentication(realm="CycleCloud") | |
# otherAuth = OtherCustomAuthModule() | |
# | |
# auth = MultiAuthentication([httpAuth, otherAuth]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Vows: http://vowsjs.org/ | |
SASS: http://sass-lang.com/ | |
SSHGuard (pretty decent layout): http://www.sshguard.net/ | |
Django Haystack: http://haystacksearch.org/ | |
twelvesouth (products not project, but still): http://www.twelvesouth.com/ |
OlderNewer