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
| # -*- mode: ruby -*- | |
| # vi: set ft=ruby : | |
| Vagrant::Config.run do |config| | |
| config.vm.box = "precise32" | |
| config.vm.box_url = "http://files.vagrantup.com/precise32.box" | |
| config.vm.network :hostonly, "33.33.33.33" |
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
| #!/usr/bin/env python | |
| #-*- coding: utf-8 -*- | |
| from functools import partial, wraps | |
| def debug_old(prefix=''): | |
| def debug(func): | |
| @wraps(func) | |
| def wrapper(*args, **kwargs): | |
| print(prefix + func.__name__) |
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
| #!/usr/bin/env python | |
| #-*- coding: utf-8 -*- | |
| from functools import wraps | |
| from getpass import getpass | |
| import sys | |
| from db import Users | |
| Logged = False |
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 feliz(number, results=None): | |
| if results is None: | |
| results = [] | |
| next_number = sum(int(a) ** 2 for a in str(number)) | |
| if next_number in results: | |
| return False | |
| if next_number != 1: |
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 pickle | |
| import os | |
| class ModelBase(type): | |
| models = [] | |
| def __new__(cls, name, bases, attrs): | |
| attrs.update({ |
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
| Feature: Log in django admin | |
| Scenario: Log in django admin with correct user and password | |
| Given I have the user admin and password admin | |
| When I fill the form and submit | |
| Then I see the text "Encerrar sessão" | |
| Scenario: Log in django admin with incorrect user and password | |
| Given I have the user invald_admin and password invalid_password | |
| When I fill the form and submit |
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
| # language: pt-br | |
| Funcionalidade: Log in no admin do django | |
| Cenário: Login no admin do django com usuário e senha corretos | |
| Dado o usuário "admin" e a senha "admin" | |
| Quando eu preencher o formulário de login e enviar os dados | |
| Então devo ver na tela a mensagem "Encerrar sessão" | |
| Cenário: Login no admin do django com usuário e senha incorretos | |
| Dado o usuário "usuario_invalido" e a senha "senha_invalida" |
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 random | |
| class Character(object): | |
| NINJA_NAMES = ['Yumiko Reptile', 'Yori Ninja', 'Yuuko Zero'] | |
| def __init__(self, name, skills): | |
| self.name = name | |
| self.skills = skills |
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
| #!/usr/bin/env python | |
| #-*- coding: utf-8 -*- | |
| class User(object): # Definição da classe User que herda de object(ler sobre new-stye class) | |
| # seq é um atributo da classe para contar quantas instâncias de User já foram salvas(chamaram o método save) | |
| seq = 0 | |
| # objects é a lista de instâncias de User que foram salvas(que chamaram o método save). | |
| # O atributo poderia ter qualquer nome. | |
| objects = [] |
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 | |
| play_file="play-2.2.3" | |
| playurl="http://downloads.typesafe.com/play/2.2.3/$play_file.zip" | |
| platform="`uname`" | |
| downloader="" | |
| if [[ $platform == 'Linux' ]]; then | |
| downloader='wget' | |
| elif [[ $platform == 'Darwin' ]]; then | |
| downloader='curl -O' | |
| fi |