Skip to content

Instantly share code, notes, and snippets.

View kkinder's full-sized avatar

Ken Kinder kkinder

View GitHub Profile
@jace
jace / dump.sql
Created September 14, 2012 18:58
SQLAlchemy joined table inheritance and mixins
PRAGMA foreign_keys=OFF;
BEGIN TRANSACTION;
CREATE TABLE node (
id INTEGER NOT NULL, -- from Mixin
name VARCHAR(200), -- from Mixin
published BOOLEAN NOT NULL,
type VARCHAR(20),
title VARCHAR(200), -- from Mixin
PRIMARY KEY (id),
CHECK (published IN (0, 1))
@cgbystrom
cgbystrom / cors_middleware.py
Created June 27, 2012 12:06
WSGI middleware for serving CORS compatible requests
class CORSMiddleware(object):
"""Enable serving of CORS requests (http://en.wikipedia.org/wiki/Cross-origin_resource_sharing)"""
ALLOW_ORIGIN = "*"
ALLOW_HEADERS = "Origin, X-Requested-With, Content-Type"
def __init__(self, app):
self.app = app
def __call__(self, environ, start_response):