This file contains hidden or 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
<!DOCTYPE html> | |
<title>CoffeeScript/Processing</title> | |
<script src="https://raw.github.com/jeresig/processing-js/master/processing.js"></script> | |
<script src="https://raw.github.com/jashkenas/coffee-script/master/extras/coffee-script.js"></script> | |
<script src="https://raw.github.com/gist/1114064/professing.js"></script> | |
<script type="text/coffeescript"> | |
sketch -> |
This file contains hidden or 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
<!DOCTYPE html> | |
<title>CoffeeScript/Processing</title> | |
<script src="https://raw.github.com/jeresig/processing-js/master/processing.js"></script> | |
<script src="https://raw.github.com/jashkenas/coffee-script/master/extras/coffee-script.js"></script> | |
<script src="https://raw.github.com/gist/1114064/professing.js"></script> | |
<script type="text/coffeescript"> | |
sketch -> |
This file contains hidden or 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
description "upstart configuration for gunicorn" | |
start on runlevel [2345] | |
stop on runlevel [!2345] | |
respawn | |
exec /home/jamie/.virtualenvs/projectname/bin/gunicorn_django -c /home/jamie/code/projectname/gunicorn.py /home/jamie/code/projectname/settings/production.py |
This file contains hidden or 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
from django.db import connection | |
from django.utils.log import getLogger | |
logger = getLogger(__name__) | |
class QueryCountDebugMiddleware(object): | |
""" | |
This middleware will log the number of queries run | |
and the total time taken for each request (with a | |
status code of 200). It does not currently support |
This file contains hidden or 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
from twisted.internet import reactor | |
from twisted.web.proxy import ReverseProxyResource | |
from twisted.web.server import Site | |
from twisted.web.resource import Resource | |
class DynamicSubdomainReverseProxy(Resource): | |
isLeaf = False | |
allowedMethods = ("GET", "POST", "PUT", "DELETE", "HEAD", "OPTIONS") | |
def getChild(self, path, request): |
This file contains hidden or 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
# clone django from github and run its test suite | |
git clone https://github.com/django/django.git | |
cd django/tests | |
PYTHONPATH=`pwd`/../ ./runtests.py --settings=test_sqlite |
This file contains hidden or 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
from flask import Flask, request | |
from google.appengine.api.mail import InboundEmailMessage | |
import notifo | |
from config import NOTIFO_USER, NOTIFO_KEY | |
app = Flask(__name__) | |
@app.route("/_ah/mail/<address>", methods=['POST']) | |
def receive_mail(address): | |
message = InboundEmailMessage(request.data) |
This file contains hidden or 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
from django.core.management import setup_environ, call_command | |
import settings | |
setup_environ(settings) | |
call_command('runserver') | |
# This doesn't work from a Python REPL shell because the auto reloader is multithreaded |
This file contains hidden or 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
<?php | |
// You can do some very odd things with PHP's __get method | |
class Chain { | |
private $chain = array(); | |
public static function it() { | |
return new self; |
This file contains hidden or 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
# autocomplete.py - Redis autocomplete example | |
# download female-names.txt from http://antirez.com/misc/female-names.txt | |
# Ruby original: http://gist.github.com/574044 | |
# Requires http://github.com/andymccurdy/redis-py/ | |
from redis import Redis | |
r = Redis() | |
KEY = 'compl' |