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
def main_loop(f): | |
def func(): | |
while True: | |
f() | |
return func | |
@main_loop | |
def main_loop_function(): | |
print "Whoooo! I'm in loop!" |
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 | |
PROJECT_ROOT="$VIRTUAL_ENV/src" | |
MEDIA_DIR="$VIRTUAL_ENV/.git/media" | |
python $PROJECT_ROOT/manage.py test | |
if test "$?" -ne 0 | |
then | |
notify-send 'Hammertime!' -t 3000 -i $MEDIA_DIR/hammertime.gif |
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
python << EOF | |
import vim | |
def line_up(): | |
current_line_number = int(vim.eval('line(".")')) | |
current_line = vim.current.line | |
dest_line_number = current_line_number - 1 | |
if current_line_number != 1: | |
vim.current.buffer.append(current_line, dest_line_number - 1) |
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.test import TestCase | |
from your_app.signals import your_signal | |
class YourTestClass(TestClass): | |
@classmethod | |
def setUpClass(cls): | |
# Save original receivers | |
cls.signal_receivers = your_signal.receivers | |
# Erase them |
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 mongoengine import * | |
from mongoengine_fuel import MongoFuel | |
class Person(Document): | |
name = StringField() | |
age = IntField() | |
def __unicode__(self): | |
return u'%s - %d years' % (self.name, self.age) |
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
map <C-S-Left> <c-w>< | |
map <C-S-Right> <c-w>> | |
map <C-S-Up> <c-w>- | |
map <C-S-Down> <c-w>+ |
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
$(function(){ | |
//Lazyload function | |
$.fn.lazyload = function(){ | |
var image = $(this); | |
if (image.attr('real-src')){ | |
image.attr('src', image.attr('real-src')); | |
image.removeAttr('real-src'); | |
} | |
return this; |
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
#coding:utf-8 | |
from django.test import Client | |
from django.conf import settings | |
from django.db.models.query import QuerySet | |
from django.contrib.auth.models import User | |
from django.test import TestCase as DjangoTestCase | |
from django.core.urlresolvers import reverse, NoReverseMatch | |
class StatusCodeAssertsMixin(object): | |
""" |
OlderNewer