Skip to content

Instantly share code, notes, and snippets.

Marc-Olivier Titeux motiteux

Block or report user

Report or block motiteux

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View index.html
<!DOCTYPE html>
<meta charset="utf-8">
<style>
body {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
width: 960px;
height: 500px;
position: relative;
}
View middleware.py
"""Add user created_by and modified_by foreign key refs to any model automatically.
Almost entirely taken from https://github.com/Atomidata/django-audit-log/blob/master/audit_log/middleware.py"""
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
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)
* http://stackoverflow.com/questions/12444774/how-to-force-html-background-to-bottom-when-page-is-smaller-than-window
*/
html, body {
height: 100%;
/* The html and body elements cannot have any padding or margin. */
background: url(http://upload.wikimedia.org/wikipedia/commons/2/22/Turkish_Van_Cat.jpg) no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
View helpers_data.py
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
33
>>> 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
@motiteux
motiteux / about.md
Created Dec 22, 2011 — forked from fogus/about.md
Programming Achievements: How to Level Up as a Developer
View about.md
You can’t perform that action at this time.