Skip to content

Instantly share code, notes, and snippets.

View jefftriplett's full-sized avatar
Living the dream

Jeff Triplett jefftriplett

Living the dream
View GitHub Profile
; A wrapper to access Tokyo Cabinet from clojure
(ns tokyo-cabinet
; exclude symbols we'll use in our API
(:refer-clojure :exclude [use get]))
(declare *db*)
(defn get [key] (.get *db* key))
"""
Copyright (c) 2008-2009, Nathan Borror, and modified heavily by Eric Florenzano
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list
of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this
import datetime
from django.db import models
class Frob(models.Model):
name = models.CharField(max_length=255)
created = models.DateTimeField(default=datetime.datetime.now)
class Fritz(models.Model):
age = models.IntegerField(default=5)
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
fabfile for Django
------------------
see http://morethanseven.net/2009/07/27/fabric-django-git-apache-mod_wsgi-virtualenv-and-p/
modified for fabric 0.9/1.0 by Hraban (fiëé visuëlle)
several additions, corrections and customizations, too
@jefftriplett
jefftriplett / conf.py
Created December 1, 2009 16:01 — forked from ella/conf.py
from my_settings import Settings
MONGODB_HOST = 'localhost'
MONGODB_PORT = 27017
MONGODB_DB = 'events'
MONGODB_COLLECTION = 'events'
ROUTING_KEY = 'events'
EXCHANGE = 'events'
QUEUE = 'events'
import functools
class memoize(object):
def __init__(self, func):
self.func = func
self.cache = {}
def __call__(self, *args):
return self.cache_get(args, lambda: self.func(*args))
def __get__(self, obj, objtype):
return self.cache_get(id(obj), lambda: self.__class__(functools.partial(self.func, obj)))
// Attempt to make a drop-and-forget bunch of scripts that mimick some missing html5 goodies automatically
// Example:
// $(document).ready(function() {
// ProvideHtml5.autofocus()
// ProvideHtml5.datepicker()
// ProvideHtml5.forcenumber()
// })
var ProvideHtml5 = {
autofocus = function() {
"""
Git Repo:
branches
dev
worker
production
master
dev
#!/usr/bin/env python
from __future__ import with_statement # needed for python 2.5
from fabric.api import *
from fabric.contrib.console import confirm
# ================================================================
# NOTE:
# using this fabfile expects that you have the python utility
# fabric installed locally, ssh access to reamea.com, and your
# ssh public key associated with the account 'mboza@reamea.com'
try:
from ipdb import Pdb
except ImportError:
from pdb import Pdb
import sys
class PdbTraceback(object):
"""
Drops into pdb or ipdb if a view raises an exception. Should be the last
thing in MIDDLEWARE_CLASSES
"""