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
# 00 prepended to filename so this shows up first in the list of gists. | |
import socket | |
import time | |
import simplejson | |
from django.conf import settings | |
def log_event(logger, event, request=None, data=None, |
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
#!/bin/sh | |
# | |
# Copyright (c) 2010 Warren Merrifield | |
# | |
# Permission is hereby granted, free of charge, to any person obtaining a copy | |
# of this software and associated documentation files (the "Software"), to deal | |
# in the Software without restriction, including without limitation the rights | |
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
# copies of the Software, and to permit persons to whom the Software is | |
# furnished to do so, subject to the following conditions: |
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 simplejson | |
from django.contrib.sessions.backends.base import SessionBase, CreateError | |
from django_ext.redis_helper import get_redis | |
class SessionStore(SessionBase): | |
""" | |
A Redis-based session store. |
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
au BufNewFile,BufRead *.js set makeprg=gjslint\ % | |
" The ^G at the end is an actual <Ctrl-G> char. | |
" Gist won't let me include it, so you'll have to delete the last two characters | |
" and insert it yourself with <Ctrl-V><Ctrl-G> | |
au BufNewFile,BufRead *.js set errorformat=%-P-----\ FILE\ \ :\ \ %f\ -----,Line\ %l\\,\ E:%n:\ %m,%-Q,%-GFound\ %s,%-GSome\ %s,%-Gfixjsstyle%s,%-Gscript\ can\ %s,%-G^G |
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
GitHub.TreeSlider = function () { | |
if (window.history && window.history.pushState) { | |
function a() { | |
if (e.sliding) { | |
e.sliding = false; | |
$(".frame-right").hide(); | |
$(".frame-loading:visible").removeClass("frame-loading") | |
} | |
} | |
if (!($("#slider").length == 0 || !GitHub.shouldSlide)) if (!navigator.userAgent.match(/(iPod|iPhone|iPad)/)) { |
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 django.db.models.signals import post_init | |
def track_data(*fields): | |
""" | |
Tracks property changes on a model instance. | |
The changed list of properties is refreshed on model initialization | |
and save. | |
>>> @track_data('name') |
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
""" | |
Straight Include template tag by @HenrikJoreteg | |
Django templates don't give us any way to escape template tags. | |
So if you ever need to include client side templates for ICanHaz.js (or anything else that | |
may confuse django's templating engine) You can is this little snippet. | |
Just use it as you would a normal {% include %} tag. It just won't process the included text. |
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
# Class that can help django-piston process multiple types of authentication | |
# Example usage: | |
# | |
# from piston.authentication import HttpBasicAuthentication | |
# from somewhere import OtherCustomAuthModule | |
# | |
# httpAuth = HttpBasicAuthentication(realm="CycleCloud") | |
# otherAuth = OtherCustomAuthModule() | |
# | |
# auth = MultiAuthentication([httpAuth, otherAuth]) |
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
#!/bin/bash | |
# simple shmsetup script | |
page_size=`getconf PAGE_SIZE` | |
phys_pages=`getconf _PHYS_PAGES` | |
shmall=`expr $phys_pages / 2` | |
shmmax=`expr $shmall \* $page_size` | |
echo kernel.shmmax = $shmmax | |
echo kernel.shmall = $shmall |
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
Vows: http://vowsjs.org/ | |
SASS: http://sass-lang.com/ | |
SSHGuard (pretty decent layout): http://www.sshguard.net/ | |
Django Haystack: http://haystacksearch.org/ | |
twelvesouth (products not project, but still): http://www.twelvesouth.com/ |