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
" Author: Bernardo Fontes <falecomigo@bernardofontes.net> | |
" Website: http://www.bernardofontes.net | |
" This code is based on this one: http://www.cmdln.org/wp-content/uploads/2008/10/python_ipdb.vim | |
" I worked with refactoring and it simplifies a lot the remove breakpoint feature. | |
" To use this feature, you just need to copy and paste the content of this file at your .vimrc file! Enjoy! | |
python << EOF | |
import vim | |
import re | |
ipdb_breakpoint = 'import ipdb; ipdb.set_trace()' |
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; |
OlderNewer