Skip to content

Instantly share code, notes, and snippets.

View kennethlove's full-sized avatar
🦀
Python

Kenneth Love kennethlove

🦀
Python
View GitHub Profile
here = lambda * x: os.path.join(os.path.abspath(os.path.dirname(__file__)), *x)
PROJECT_ROOT = here("..", "..")
root = lambda * x: os.path.join(os.path.abspath(PROJECT_ROOT), *x)
MEDIA_ROOT = root("media")
STATIC_ROOT = root("static")
STATICFILES_DIRS = (
root("assets"),
)
class GameSerializer(serializers.ModelSerializer):
class Meta:
model = Game
fields = ('id', 'name', 'ident')
IntegrityError at /games/api/games/2a8a8cdc
duplicate key value violates unique constraint "games_game_pkey"
DETAIL: Key (id)=(11) already exists.
Request Method: PATCH
Request URL: http://gamenight.dev:8000/games/api/games/2a8a8cdc?_method=PATCH&format=json&name=Dungeon!
Django Version: 1.5
Python Executable: /Users/kennethlove/.virtualenvs/gamenight/bin/python
Python Version: 2.7.3
<h1 contentEditable="true" ng-model="name" title="Click to edit">
{{ selected_game.name }}
</h1>
<time>{{ selected_game.updated_at }}</time>
<div>
<button ng-click="$delete()" class="btn btn-danger">DELETE</button>
<a href="#/games">Back</a>
</div>
class Post(models.Model):
created_at = models.DateTimeField(auto_now_add=True, editable=False)
updated_at = models.DateTimeField(auto_now=True, editable=False)
title = models.CharField(max_length=255)
slug = models.SlugField(max_length=255, blank=True, default='')
content = models.TextField()
published = models.BooleanField(default=True)
author = models.ForeignKey(User, related_name="posts")
objects = PostManager()
#! /usr/bin/env python
pages = {
"start": {
"text": "It's a dark night outside. Somewhere a wolf howls.",
"prompt": "Where will you take shelter, the haunted house, or the bat "
"cave?",
"next": ("haunted house", "bat cave"),
},
"haunted house": {
@kennethlove
kennethlove / gist:5725610
Created June 6, 2013 22:45
Find quotes that don't start with a 'u'
regex = ur'(\s|\=|\(|\[|\{)[u]{0}(\'|\")(?!\"\")(?!\'\')'
Dear Kenneth Love,
After running by your project Getting Started With Django we strongly believe there is definitely a synergy opportunity in store for both of us. You’ve got an awesome project, while we have an unprecedented SEO platform that is designed for the client to pay only if we drive substantial results. We’re the only ones in the world to offer the total opposite of what any other SEO company does, and all of our campaigns are 100% refundable if we don’t achieve results. In fact, we have vast experience in your niche and know exactly how to accomplish results. We want to demonstrate this to you – that's why we’ve taken the liberty to contact you.
Can you contact us via e-mail at global@XXXXXX.com or through our toll-free +1 (800) SEO-XXXX number? We’re extremely interested in doing some comprehensive SEO work on your website. Your project is incredible! Pursuant to our preliminary assessment, it’s the best time to propel your current website given your success through crowd funding.
[tox]
envlist = py2.6-d1.3, py2.7-d1.3, py2.6-d1.4, py2.7-d1.4, py2.7-d1.5, py3.3-d1.5, py3.3-d1.6, py2.7-d1.6
[testenv]
commands =
py.test tests/
deps =
mock
pytest-django