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 redis | |
from django.conf import settings | |
from django.core.signals import request_finished | |
try: | |
from eventlet.corolocal import local | |
except ImportError: | |
from threading import local |
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 httplib | |
import simplejson | |
# Based on Christian Dowski's iresponse http://blog.dowski.com/2008/04/02/reading-chunked-http11-responses/ | |
class IterableResponse(httplib.HTTPResponse, object): | |
def __iter__(self): | |
assert self.chunked != httplib._UNKNOWN, "Response is not chunked!" |
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
from flask import Module, request, redirect, url_for, render_template, abort | |
from formalchemy import FieldSet | |
from example import db | |
from example import Service, User, Forum, Category, Topic, Post | |
mod = Module(__name__) | |
models = { |
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
import uuid | |
import simplejson | |
import amqplib.client_0_8 as amqp | |
class SimpleCelery(object): | |
def __init__(self, task_map, host, port, user, password, exchange, vhost, | |
ssl=False, retries=5, routing_key='celery'): | |
self._task_map = task_map |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8" /> | |
<title>ASDF</title> | |
<style> | |
.animate { | |
-webkit-transition-property: -webkit-transform; | |
-webkit-transition-duration: 2s; | |
-webkit-transform: matrix3d(0.5, -0.5, -0.707107, 0, 0.853553, 0.146447, 0.5, 0, -0.146447, -0.853553, 0.5, 0, 0, 0, 0, 1); |
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
<ul> | |
{{#tweets}} | |
<li>{{text}}</li> | |
{{/tweets}} | |
</ul> |
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 | |
import time | |
from eventlet import patcher, greenpool, pools | |
patcher.monkey_patch() | |
import simplegeo | |
LAYER = 'your.layer.identifier.here' | |
OAUTH_KEY = 'YOUR OAUTH KEY HERE' |
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
# Copypasta of Django's runserver management command, modified to use gunicorn http://github.com/benoitc/gunicorn | |
import os | |
import signal | |
import sys | |
import threading | |
import time | |
from optparse import make_option |