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("[bffdcas] EditarPerfilModel reset password ", function() { | |
| var alertModel; | |
| beforeEach(angular.mock.module('perfil_usuario')); | |
| beforeEach(angular.mock.module('mockhttp')); | |
| beforeEach(function (){ | |
| // mocka o alertModel | |
| alertModel = { |
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
| WHITE = (255, 255, 255) | |
| class Game(object): | |
| SCREEN_SIZE = (800, 600) | |
| def __init__(self): | |
| pygame.init() | |
| self.screen = pygame.display.set_mode(Game.SCREEN_SIZE) | |
| self.screen.fill(WHITE) |
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
| class Water(object): | |
| def __init__(self): | |
| self._wet = False | |
| @property | |
| def wet(self): | |
| return self._wet | |
| @wet.setter |
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
| # raw types are immutable variables | |
| x = 1 | |
| def change(x): | |
| x = 2 | |
| change(x) | |
| assert x == 1 | |
| # you can use the global statement, but it's not a good practice |
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 | |
| from flask import Flask, request, render_template | |
| app = Flask(__name__) | |
| @app.route("/send", methods=["POST"]) | |
| def send(): | |
| return request.form["data"] |
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 | |
| import unittest | |
| from pprint import pprint | |
| DEBUG = True | |
| def greedy(g): | |
| vertices = [] |
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
| Uma boa forma de entender orientação a objetos é pensar na responsabilidade única que sua classe deve ter. | |
| **O que é responsabilidade única?** | |
| O princípio de responsabilidade única diz que cada componente do seu sistema seja ele classe, método, módulo, etc deve conter a responsabilidade de apenas uma parte do seu sistema. | |
| Classes são abstrações de responsabilidades do seu sistema. | |
| **Mas o que isso quer dizer em termos práticos?** Imagine o seguinte caso: | |
| Qual a responsabilidade única da classe file do python? |
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 | |
| """ | |
| Instale: | |
| pip install sounddevice | |
| pip install soundfile | |
| baixe esse arquivo de audio e renomeie para: audio.ogg | |
| https://upload.wikimedia.org/wikipedia/en/9/9f/Sample_of_%22Another_Day_in_Paradise%22.ogg | |
| """ |
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
| {"id": 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
| from flask.ext.login import current_user | |
| @api.resource('/user/logged') | |
| class Logged(Resource): | |
| def get(self): | |
| try: | |
| return {"logged": current_user.to_dict()} | |
| except AttributeError: |