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
# Django virtualenv helpers | |
VIRTUALENV_PROJECTS=~/projects | |
# work on virtualenv | |
function workon(){ | |
cd $VIRTUALENV_PROJECTS/$1 | |
source bin/activate | |
} | |
# Run Django management commands |
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
# Ajaxterm was written by Antony Lesuisse (email: al AT udev.org), | |
# License Public Domain. | |
# Terminal class made serializable/picklealbe by using a Metaclass | |
# (c) 2009 FastSoft | |
# MIT License | |
import array, cgi, re | |
def TerminalMetaclass(name, bases, attys): |
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 import models | |
from django.utils import simplejson as json | |
from django.conf import settings | |
from datetime import datetime | |
class JSONEncoder(json.JSONEncoder): | |
def default(self, obj): | |
if isinstance(obj, datetime): | |
return obj.strftime('%Y-%m-%d %H:%M:%S') |
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 import models | |
from django.utils import simplejson as json | |
from django.conf import settings | |
from datetime import datetime | |
class JSONEncoder(json.JSONEncoder): | |
def default(self, obj): | |
if isinstance(obj, datetime): | |
return obj.strftime('%Y-%m-%d %H:%M:%S') |
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 import models | |
from django.utils import simplejson as json | |
from django.conf import settings | |
from datetime import datetime | |
class JSONEncoder(json.JSONEncoder): | |
def default(self, obj): | |
if isinstance(obj, datetime): | |
return obj.strftime('%Y-%m-%d %H:%M:%S') |
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 time | |
class Retry(object): | |
default_exceptions = (Exception) | |
def __init__(self, tries, exceptions=None, delay=0): | |
""" | |
Decorator for retrying function if exception occurs | |
tries -- num tries | |
exceptions -- exceptions to catch |
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
/* | |
* Fabrizio Calderan, twitter @fcalderan, 2010.11.02 | |
* I had an idea: could Inception movie be explained by a few javascript closures | |
* and variable resolution scope (just for fun)? | |
* | |
* Activate javascript console =) | |
*/ | |
<script> | |
console.group("inception movie"); |
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 import models | |
from django.utils import simplejson as json | |
from django.conf import settings | |
from datetime import datetime | |
import time | |
class JSONEncoder(json.JSONEncoder): | |
def default(self, obj): | |
if isinstance(obj, datetime): | |
return obj.strftime('%Y-%m-%d %H:%M:%S') |
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 time | |
class Timing(object): | |
def __init__(self): | |
self.timings = {} | |
self.col = self.__collector() | |
self.col.next() #coroutine syntax | |
def __collector(self): | |
while True: |
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
var kkeys = [], | |
konami = "38,38,40,40,37,39,37,39,66,65"; | |
easterEgg = function (e) { | |
kkeys.push(e.keyCode); | |
if (kkeys.toString().indexOf(konami) == 0) { | |
var ee = $('<div id="ee">TROLOLOL</div>'); | |
ee.css({ |
OlderNewer