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.views.generic import ListView | |
| from sgf.utils.decorators import page, permission_required_sgf | |
| from sgf.administrativo.models import ComiteRegional | |
| from sgf.administrativo.forms import FormComiteRegionalBusca | |
| ...... | |
| class SearchListView(ListView): |
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
| function auto_activate { | |
| SEARCHPATH=`pwd` | |
| function activate_env { | |
| # ZSH outputs errors for the ls * command if you don't disable the nomatch output | |
| unsetopt nomatch 2>/dev/null | |
| ls $SEARCHPATH/*/bin/activate > /dev/null 2> /dev/null | |
| if [ "$?" = '0' ]; then | |
| deactivate > /dev/null 2> /dev/null |
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 -*- | |
| import urllib | |
| try: | |
| import json | |
| except ImportError: | |
| import simplejson as json | |
| import pickle | |
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 timeit | |
| t = timeit.Timer("v=sorted(d.items(), key=lambda x: x[1])[-1]", | |
| "d = {'a': 1000, 'b': 3000, 'c':100}") | |
| print t.timeit() | |
| # 1.648s | |
| t = timeit.Timer("v=max(d.iteritems(), key = operator.itemgetter(1))[0]", | |
| "import operator; d = {'a': 1000, 'b': 3000, 'c':100}") | |
| print t.timeit() |
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 -*- | |
| import sys, re | |
| import itertools | |
| from functools import wraps | |
| from pyquery import PyQuery as pq | |
| class scrape: | |
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 posts.models import User, Post, Amigos | |
| >>> # Cria joao | |
| >>> joao = User(username="joao", first_name="João", email="joao@gmail.com") | |
| >>> joao.save() | |
| >>> # Cria jose | |
| >>> jose = User(username="jose", first_name="José", email="jose@gmail.com") | |
| >>> jose.save() |
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 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 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
| 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 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
| # -*- 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 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 |
OlderNewer