Skip to content

Instantly share code, notes, and snippets.

View sebleier's full-sized avatar

Sean Bleier sebleier

  • Counsyl, Inc
  • San Luis Obispo, Ca
View GitHub Profile
i
me
my
myself
we
our
ours
ourselves
you
your
@sebleier
sebleier / gist:1127937
Created August 5, 2011 16:39
This is how I kinda wished django migrations would work.
$ git checkout master
Already on 'master'
$ django-admin.py migrate
Error: Cannot migrate in a dirty state
$ git commit -am "Added migration to remove blog entry's pub_month and pub_day fields."
$ django-admin.py tag_migration add_column_to_foo # tags a migration identifier using git-tag
$ django-admin.py migrate
last known sha: c39168d21bb27754737a1036a50f57687cf6ae56
new migrations found between c39168..HEAD:
@sebleier
sebleier / gist:2891440
Created June 7, 2012 20:46 — forked from hay/gist:1351230
Enterprisify your Java Class Names!
<!doctype html>
<html>
<head>
<title></title>
<style>
body {
background: white;
text-align: center;
padding: 20px;
font-family: Georgia, serif;
@sebleier
sebleier / gist:1473587
Created December 13, 2011 19:49
Big-Q notation

Big-Q Notation

Big-Q notation is exactly the same as Big-O notation, except for the understanding that the constant multiplier for the asymptotic bound function is greater.

For example Big-O is defined as:

f(x) <= C * g(x) 

Big-Q notation could be defined as:

@sebleier
sebleier / nav_footer
Created June 16, 2011 20:12 — forked from anonymous/nav_footer
New navigation footer
>>> class Foo(object):
... a = {}
... b = 'bar'
...
... f = Foo()
... f.a['animal'] = "monkey"
... f.bar = 'not bar'
... g = Foo()
... print g.a, g.b
{'animal': 'monkey'} bar
#! /bin/sh
### BEGIN INIT INFO
# Provides: redis-server
# Required-Start: $syslog
# Required-Stop: $syslog
# Should-Start: $local_fs
# Should-Stop: $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: redis-server - Persistent key-value db
class WSGIHandlerWrapper(WSGIHandler):
def __init__(self):
settings.configure(DEBUG_PROPAGATE_EXCEPTIONS=True)
super(WSGIHandlerWrapper, self).__init__()
def handle_uncaught_exception(self, request, resolver, exc_info):
try:
super(WSGIHandlerWrapper, self).handle_uncaught_exception(request, resolver, exc_info)
except Exception, e:
# do something
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.