Skip to content

Instantly share code, notes, and snippets.

@mikeyk
mikeyk / redis_session_backend.py
Created April 8, 2011 18:01
A redis backend for Django Sessions, tested on Django 1.3+
from django.contrib.sessions.backends.base import SessionBase, CreateError
from django.conf import settings
from django.utils.encoding import force_unicode
import redis
class SessionStore(SessionBase):
""" Redis store for sessions"""
def __init__(self, session_key=None):
self.redis = redis.Redis(
@rmariuzzo
rmariuzzo / compile-js.sh
Last active December 21, 2015 14:39
A simple NodeJS script to watch for changes in a specific less and js file. When changes detected then bash script will be executed for to compile less files and to uglify js scripts.
clear
curdir="${0%/*}"
uglifyjs -v \
$curdir/jquery/jquery.js \
$curdir/twbs/js/bootstrap.js \
$curdir/superfish/superfish.js \
$curdir/site/js/site.js \
-o $curdir/../../js/app.js \
-m
echo 'JS files compiled successfully!'
@samwize
samwize / mocha-guide-to-testing.js
Created February 8, 2014 05:53
Explain Mocha's testing framework - describe(), it() and before()/etc hooks
// # Mocha Guide to Testing
// Objective is to explain describe(), it(), and before()/etc hooks
// 1. `describe()` is merely for grouping, which you can nest as deep
// 2. `it()` is a test case
// 3. `before()`, `beforeEach()`, `after()`, `afterEach()` are hooks to run
// before/after first/each it() or describe().
//
// Which means, `before()` is run before first it()/describe()