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
import asyncio | |
import random | |
async def slow_action(): | |
await asyncio.sleep(random.randrange(1, 5)) | |
async def my_range(n): | |
i = 0 | |
while i < n: |
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: Eduardo Frazão | |
# OBS: this is for my android phone with Qpython3. | |
# that's my personal trainer \o/ | |
from time import sleep | |
from subprocess import call | |
import sl4a | |
droid = sl4a.Android() | |
call("clear") |
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
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import math | |
import re | |
# dado um título e lista de listas no formato | |
# ('<variável>', '<tipo>', '<descricao>', '<fórmula>') | |
# pede-se qual variável calcular, pede os valores e dá o resultado | |
# qualquer valor vazio saida da função |
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
# 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 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 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 -*- | |
#-------------------------------------------------------------- | |
# myposconfig.py - *Configuração após instalar Ubuntu 13.04 > | |
# Autor: Jhonathan Paulo Banczek | |
# 09-03-2014 - jhoonb.com | |
# Python 2.7 > | |
# - *configurações pessoais | |
#-------------------------------------------------------------- |
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
angular.module('myApp', | |
['ngRoute', 'myApp.services', 'myApp.directives'] | |
) | |
.config(function(AWSServiceProvider) { | |
AWSServiceProvider.setArn('arn:aws:iam::<ACCOUNT_ID>:role/google-web-role'); | |
}) | |
.config(function(StripeServiceProvider) { | |
StripeServiceProvider.setPublishableKey('pk_test_YOURKEY'); | |
}) | |
.config(function($routeProvider) { |
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 import http | |
try: | |
from django.conf import settings | |
XS_SHARING_ALLOWED_ORIGINS = settings.XS_SHARING_ALLOWED_ORIGINS | |
XS_SHARING_ALLOWED_METHODS = settings.XS_SHARING_ALLOWED_METHODS | |
XS_SHARING_ALLOWED_HEADERS = settings.XS_SHARING_ALLOWED_HEADERS | |
XS_SHARING_ALLOWED_CREDENTIALS = settings.XS_SHARING_ALLOWED_CREDENTIALS | |
except AttributeError: | |
XS_SHARING_ALLOWED_ORIGINS = '*' |
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 posts.models import User, Post, Amigos | |
>>> # Cria joao | |
>>> joao = User(username="joao", first_name="João", email="[email protected]") | |
>>> joao.save() | |
>>> # Cria jose | |
>>> jose = User(username="jose", first_name="José", email="[email protected]") | |
>>> jose.save() |
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
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import sys, re | |
import itertools | |
from functools import wraps | |
from pyquery import PyQuery as pq | |
class scrape: | |
NewerOlder