Skip to content

Instantly share code, notes, and snippets.

from django.template.defaultfilters import slugify
class Ingredient(models.Model):
name = models.CharField(max_length=200)
description = models.TextField(null=True, blank=True)
slug = models.SlugField(editable = False)
def __unicode__(self):
return u'%s' % (self.name)
def submit_form(request):
response = dict()
if request.method == 'POST':
af = AwesomeForm(request.POST)
if af.is_valid():
af_field_variable = af.cleaned_data['awesome_field'])
messages.success(request, 'Thanks for the form data!')
"""
This is an example of how to use optparse.
It may not be the best, but it's a start.
Invoke it from the command line:
python optest.py --help
python optest.py --test
python optest.py --message 'Goodbye Void'
"""
use schema.org markup for ateoto.com
First steps with django-ateoto-dayboard:
Oauth2 support for Google Services. Need to access calendar API.
Grab weather forecast for the day from the Wunderground API.
@ateoto
ateoto / gist:3397257
Created August 19, 2012 19:51
Django Nginx Gunicorn integration
http://senko.net/en/django-nginx-gunicorn/
class Animation(object):
def __init__(self, texture,
class AnimatedSprite(sf.Sprite):
def draw(self, target, states):
target.draw(self.texture)
@ateoto
ateoto / gist:3776819
Created September 24, 2012 16:23
Die Roller
import random
import re
def roll(what_roll):
"""
d20
d6+2
2d6
4d6+4
"""
@ateoto
ateoto / Coffee
Created December 29, 2012 15:21 — forked from anonymous/Coffee
For a ~16oz Chemex Cup
18oz H20
21g Coffee
@ateoto
ateoto / gist:4717331
Last active December 12, 2015 04:49
Stuff to checkout.
http://knockoutjs.com/
http://kmalakoff.github.com/knockback/
@ateoto
ateoto / ateoto
Created June 5, 2013 22:00
nginx config
upstream django {
server localhost:8000;
}
server {
listen 80;
server_name ateoto.com;
location / {
proxy_pass http://django;