Skip to content

Instantly share code, notes, and snippets.

View index.html
<!DOCTYPE html>
<meta charset="utf-8">
body {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
width: 960px;
height: 500px;
position: relative;
"""Add user created_by and modified_by foreign key refs to any model automatically.
Almost entirely taken from"""
from django.db.models import signals
from django.utils.functional import curry
class WhodidMiddleware(object):
def process_request(self, request):
if not request.method in ('GET', 'HEAD', 'OPTIONS', 'TRACE'):
if hasattr(request, 'user') and request.user.is_authenticated():
user = request.user
motiteux / dabblet.css
Created Mar 9, 2014
How to force HTML background to bottom when page is smaller than window (SO)
View dabblet.css
* How to force HTML background to bottom when page is smaller than window (SO)
html, body {
height: 100%;
/* The html and body elements cannot have any padding or margin. */
background: url( no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
def namedlist(typename, field_names):
"""Returns a new subclass of list with named fields.
>>> Point = namedlist('Point', ('x', 'y'))
>>> Point.__doc__ # docstring for the new class
'Point(x, y)'
>>> p = Point(11, y=22) # instantiate with positional args or keywords
>>> p[0] + p[1] # indexable like a plain list
>>> x, y = p # unpack like a regular list
View gist:5416284
# Copyright 2012 Twitter
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
motiteux /
Created Dec 22, 2011 — forked from fogus/
Programming Achievements: How to Level Up as a Developer