This file contains hidden or 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 meu_decorator(f): | |
def novo_f(): | |
print 'iniciando f' | |
print 'finalizando f' | |
return novo_f | |
@meu_decorator | |
def minhafuncao(): | |
print 'dentro da funcao' |
This file contains hidden or 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
set expandtab | |
set autoindent | |
syntax enable | |
set shiftwidth=4 | |
set tabstop=4 | |
set softtabstop=4 | |
filetype plugin indent on | |
set hlsearch | |
set incsearch |
This file contains hidden or 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 fudge | |
from django.test import TestCase | |
from django.contrib.auth.models import User | |
from django.http import Http404 | |
import views | |
def stub(name = 'stub'): | |
return fudge.Fake(name).is_a_stub() | |
class AuthTest(TestCase): |
This file contains hidden or 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.http import HttpResponse | |
from models import Post | |
def posts(request): | |
posts = Post.objects.all() | |
texto = "<h1>Lista de posts:</h1>" | |
texto += "<ul>" | |
for post in posts: | |
item = "<li><a href='/blog/post/"+str(post.id)+"'>"+post.title+"</a></li>" | |
texto += item |
This file contains hidden or 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
// função pra floodar o localStorage, com o intuito de saber se o browser simplesmesnte lança uma | |
// exception quando o storage está cheio ou se o browser pergunta se o user deseja expandir o | |
// espaço disponível para o localStorage | |
function flood(){ | |
for(i=0;i<5*1024*1024;i++) { | |
window.localStorage.setItem(Math.random().toString(), Math.random().toString()) | |
} | |
} |
This file contains hidden or 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
console.log(999999999999999) | |
//999999999999999 | |
console.log(9999999999999999) | |
//10000000000000000 ==> WTF?? | |
console.log(9999999999999999+1) | |
//10000000000000000 | |
console.log(9999999999999999+2) |
This file contains hidden or 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
describe("class system", function(){ | |
it("should be possible to create classes", function(){ | |
Class({name:'MyClass'}); | |
expect(window.MyClass === undefined).toBeFalsy(); | |
}); | |
it("should be possible to create properties within classes", function(){ | |
Class({ | |
name:'MyClass', | |
attrs:{ |
This file contains hidden or 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
#excerpt from manage.py | |
settings_arg = [arg for arg in sys.argv if arg.startswith('--settings=')] | |
if settings_arg: | |
settings = __import__(settings_arg[0].split('=')[1]) | |
else: | |
import settings |
This file contains hidden or 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/bash | |
export CLASSPATH=$CLASSPATH:.:./duke-1.2.jar:./lucene-core-4.0.0.jar:./lucene-analyzers-common-4.0.0.jar | |
java no.priv.garshol.duke.Duke "$@" |
This file contains hidden or 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
echo "[xamarin]" > /etc/yum.repos.d/xamarin.repo | |
echo "name=Xamarin" >> /etc/yum.repos.d/xamarin.repo | |
echo "baseurl=http://download.mono-project.com/repo/centos/" >> /etc/yum.repos.d/xamarin.repo | |
echo "enabled=1" >> /etc/yum.repos.d/xamarin.repo | |
echo "gpgcheck=1" >> /etc/yum.repos.d/xamarin.repo | |
echo "gpgkey=http://keyserver.ubuntu.com/pks/lookup?op=get&search=0x3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF" >> /etc/yum.repos.d/xamarin.repo | |
yum update | |
yum install mono-complete |