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
"""Música do elefante. | |
Digite a quantidade de vezes que vai contar, preferencialmente um número par. | |
""" | |
elefantes = int(input('Digite quantos elefantes quer contar: ')) | |
ini = '{0} {1} {2} muita gente!' | |
ini_plural = '{0} elefantes {1}muito mais!' | |
for i in range(0, elefantes + 1): | |
if i == 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
Preparing environment : | |
-------------------------------------------------------------------------------- | |
+ HEADS UP: | |
+ This is the first build for this project and will take longer than usual. | |
+ Future builds will pull from the cache and will be much faster. | |
-------------------------------------------------------------------------------- | |
Building runtime : |
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
# encoding: utf-8 | |
def custom_exception_handler(job, exc_type, exc_value, traceback): | |
with open('test.log', 'rw') as f: | |
f.write(job) | |
f.write(exc_type) | |
f.write(exc_value) | |
f.write(traceback) | |
f.close() |
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
class indexView2(ListView): | |
queryset = Post.objects.order_by('-data') | |
template_name = "post_list.html" | |
paginate_by = 3 | |
def form_valid(self, form): | |
# Faça sua lógica aqui | |
return super(DenunciaMixin, self).form_valid(form) | |
def get_context_data(self, **kwargs): |
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
# Modelo A | |
class Modelo(model.Models): | |
user = models.ForeignKey('user.User') | |
# MODELO B | |
def other_function(instance): | |
modelos = Modelo.objects.filter(user=instance.client) | |
print(modelos) |
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
{ | |
"estados": [ | |
{ | |
"sigla": "AC", | |
"nome": "Acre", | |
"cidades": [ | |
"Acrelândia", | |
"Assis Brasil", | |
"Brasiléia", | |
"Bujari", |
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
simpleflow standalone --domain TestDomain examples.basic.BasicWorkflow --input '[1, 5. "meu texto"]' | |
2016-08-03T19:17:41 INFO [process=MainProcess, pid=20415]: using task list basic-b4cdf1cd38c949d48815f97af9a5e530 | |
starting workflow examples.basic.BasicWorkflow | |
2016-08-03T19:17:41 INFO [process=Process-2, pid=20421]: starting <bound method ActivityPoller.start of <simpleflow.swf.process.worker.base.ActivityPoller object at 0x7fbcf678fdc0>> | |
2016-08-03T19:17:41 INFO [process=Process-1, pid=20420]: starting <bound method DeciderPoller.start of DeciderPoller(TestDomain, basic-b4cdf1cd38c949d48815f97af9a5e530, basic)> | |
2016-08-03T19:17:41 INFO [process=Process-2:1, pid=20423]: starting ActivityPoller(basic) on domain TestDomain | |
2016-08-03T19:17:41 INFO [process=Process-2:3, pid=20426]: starting ActivityPoller(basic) on domain TestDomain | |
2016-08-03T19:17:41 INFO [process=Process-2:2, pid=20425]: starting ActivityPoller(basic) on domain TestDomain | |
2016-08-03T19:17:41 INFO [process=Process-1:2, pid=20424]: starting De |
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
python -c 'import random; import string; print "".join([random.SystemRandom().choice(string.digits + string.letters + "!#$%&\()*+,-./:;<=>?@[]^_{|}~" ) for i in range(100)])' |
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
class Esporte(models.Model): | |
"""(Esporte description)""" | |
nome = models.CharField(blank=True, max_length=100) | |
sexo = models.CharField(blank=True, max_length=1, choices=['M', 'F']) | |
idade = models.IntegerField() | |
def __unicode__(self): | |
return u"Esporte" |
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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |