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
*.pyc | |
.project | |
.pydevproject |
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 inspect as i;print i.stack()[0][4][0] |
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
def rmdc(a, b): | |
return b and rmdc(b, a%b) or a | |
def mdc(a, b): | |
while a: | |
a, b = b%a, a | |
return b | |
if __name__ == '__main__': | |
a = input("Informe o primeiro valor: ") |
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 pyPdf import PdfFileWriter, PdfFileReader | |
import os | |
def append_pdf(input, output): | |
[output.addPage(input.getPage(page_num)) \ | |
for page_num in range(input.numPages)] | |
output = PdfFileWriter() | |
for pdf in filter(lambda x: '.pdf' in x, os.listdir('.')): | |
append_pdf(PdfFileReader(file(pdf, "rb")), output) |
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 unittest | |
class SimplestCase(unittest.TestCase): | |
def test_simple(self): | |
self.assertEqual(1 + 1, 2) | |
if __name__ == '__main__': | |
unittest.main() |
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: | |
- php | |
php: | |
- 5.5 | |
- 5.4 | |
- 5.3 | |
before_script: | |
- chmod +x runtests.sh | |
script: | |
- ./runtests.sh |
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
def sua_view(): | |
qs = SeuModel.objects.all() | |
data = [] | |
for object in qs: | |
data.append({ | |
'nome': object.nome, | |
'idade': object.idade.strftime("%d/%m/%Y"), # objeto do tipo datetime | |
'produtos': object.produtos.values_list('id', 'descricao'), # objeto do tipo foreignkey com o model Produto | |
}) | |
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
>>> carros = Carro.objects.filter(revisao_set__isnull=False).distinct() | |
>>> ultimas_revisoes_aprovadas = [] | |
>>> for carro in carros: | |
... ultima_revisao = carro.revisao_set.latest('data') | |
... if ultima_revisao.aprovado: | |
... ultima_revisao_foi_aprovada = 'Sim' | |
... ultimas_revisoes_aprovadas.append(ultima_revisao) | |
... else: | |
... ultima_revisao_foi_aprovada = 'Nao' | |
... |
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
# Html do botão | |
<button ng-click="minhaFuncao(objeto.id)" class="btn btn-xs btn-default"> | |
<i class="fa fa-user-times"></i> | |
{{ _("Minha Funcao") }} | |
</button> | |
# Código do angularjs | |
(function(angular) { | |
var app = angular.module('meuModulo', []); |
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 socket import * | |
serverName = 'localhost' | |
serverPort = 12000 | |
clientSocket = socket(AF_INET, SOCK_STREAM) | |
clientSocket.connect((serverName, serverPort)) | |
nick = input("digite seu nick ") | |
clientSocket.send(nick.encode()) |
OlderNewer