Skip to content

Instantly share code, notes, and snippets.

View gilsondev's full-sized avatar
💼
Work

Gilson Filho gilsondev

💼
Work
View GitHub Profile
@gilsondev
gilsondev / routes.py
Created July 15, 2011 22:01 — forked from rochacbruno/routes.py
router example
#!/usr/bin/python
# -*- coding: utf-8 -*-
default_application = 'init' # ordinarily set in base routes.py
default_controller = 'default' # ordinarily set in app-specific routes.py
default_function = 'index' # ordinarily set in app-specific routes.py
routers = dict(
# base router
@gilsondev
gilsondev / oss.textile
Created September 2, 2011 12:21 — forked from kennethreitz/oss.textile
Open Source Notes

Contributing to Open Source
=======

First Rule: You can find the time
- It doesn’t take much
- Weekends are good
- Find what other time you’re wasting
- Try something that’s not your day job

Second Rule: What to contribute to?

@gilsondev
gilsondev / fstab
Created September 10, 2011 14:53
Script usado para montar as partições da minha máquina
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point> <type> <options> <dump> <pass>
proc /proc proc nodev,noexec,nosuid 0 0
# / was on /dev/sda7 during installation
UUID=7f05f7b9-be65-4c5b-ae9e-b4efa304d44f / ext4 errors=remount-ro,user_xattr 0 1
@gilsondev
gilsondev / .bashrc_virtualenvwrapper
Created September 21, 2011 16:52
Configurando o virtualenv e virtualenvwrapper no Dropbox
# Virtualenvwrapper
export WORKON_HOME=$HOME/Dropbox/Desenvolvimento/Projetos/
source /usr/local/bin/virtualenvwrapper.sh
# export VIRTUALENVWRAPPER_PYTHON='/usr/bin/python2.7'
@gilsondev
gilsondev / currencyfield.py
Created October 3, 2011 01:38
Definindo o campo DecimalField no formato 0,00
# -*- coding: utf8 -*-
"""
Script baseado no snippet abaixo:
http://djangosnippets.org/snippets/176/
Obs.: Alterei algumas coisas como:
* Import newsform para forms;
* Aceitar o formato 0,00, sendo que o formato 0.00 é aceitado por padrão.
"""
@gilsondev
gilsondev / wunderlist.desktop
Created October 3, 2011 12:42
Atalho da aplicação Wunderlist em /usr/share/applications
[Desktop Entry]
Type=Application
Version=1.0
Name=Wunderlist
Name[vi]=Wunderlist
GenericName=Task Manager
GenericName[pt_BR]=Gerenciador de Tarefas
Icon=/opt/Wunderlist-1.2.4/Resources/wunderlist.png
TryExec=/opt/Wunderlist-1.2.4/Wunderlist
Exec=/opt/Wunderlist-1.2.4/Wunderlist
@gilsondev
gilsondev / web2py_install_pip.sh
Created October 6, 2011 18:26
Instalando o web2py via pip, usando a última versão.
#!/bin/bash
# Download do web2py no pypi e no site oficial
if [-f web2py-1.96.4.tar.gz]
then
echo "Arquivo web2py vindo do Pypi já foi puxado."
else
wget http://pypi.python.org/packages/source/w/web2py/web2py-1.96.4.tar.gz#md5=c747ce40bf7becaeb4782b4c766eef94
fi
@gilsondev
gilsondev / test_models_registro.py
Created November 9, 2011 13:38
Exemplo de como testar se determinado registro foi excluído no banco de dados no Django.
# -*- coding: utf8 -*-
from django.test import TestCase
# (...)
def test_excluir_usuario(self):
"""O Usuario e excluido?"""
id_usuario = 12 # Teste desse exemplo
@gilsondev
gilsondev / tests.py
Created November 24, 2011 19:35
Teste unitario simples para uma view
# -*- coding: utf8 -*-
from django.test import TestCase
class DiagnosticosViewsTest(TestCase):
"""Testes feitos para verificar o funcionamento
do view de diagnósticos.
"""
@gilsondev
gilsondev / diagnostico_views.py
Created November 24, 2011 19:56
View do diagnostico
# -*- coding: utf8 -*-
from django.shortcuts import render_to_response
from django.template import RequestContext
from sigi.apps.diagnosticos.models import Diagnostico
def lista(request):
"""Consulta os diagnosticos do servidor logado,