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 progressbar | |
pbar = progressbar.ProgressBar(maxval=PLACEHOLDER) | |
pbar.start() | |
for i in range(PLACEHOLDER): | |
pbar.update(i) | |
pbar.finish() |
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
pg_dump -Fc -v -U user_name -d db_name -t table_name > /path/to/file.bak |
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
dfs |
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 |
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
django-admin startproject mysite |
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 manage.py runserver |
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.http import HttpResponse | |
from django.views.generic import View | |
class MyView(View): | |
def get(self, request, *args, **kwargs): | |
return HttpResponse('Hello, World!') |
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.db import models | |
class Question(models.Model): | |
question_text = models.CharField(max_length=200) | |
pub_date = models.DateTimeField('date published') | |
class Choice(models.Model): | |
question = models.ForeignKey(Question, on_delete=models.CASCADE) |
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
{% if debug %} | |
<div id="debug"> | |
<h2>Queries</h2> | |
<p> | |
{{ sql_queries|length }} Quer{{ sql_queries|pluralize:"y,ies" }} | |
{% ifnotequal sql_queries|length 0 %} | |
(<span style="cursor: pointer;" onclick="var s=document.getElementById('debugQueryTable').style;s.display=s.display=='none'?'':'none';this.innerHTML=this.innerHTML=='Show'?'Hide':'Show';">Show</span>) | |
{% endifnotequal %} | |
</p> | |
<table id="debugQueryTable" style="display: none;"> |
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 forms | |
class BandContactForm(forms.Form): | |
subject = forms.CharField(max_length=100) | |
message = forms.CharField() | |
sender = forms.EmailField() | |
cc_myself = forms.BooleanField(required=False) |
OlderNewer