Skip to content

Instantly share code, notes, and snippets.

# This will setup a working environment on a new machine
apt-get update
apt-get install subversion git-core bzr -y
apt-get install python-imaging
wget http://svn.pinaxproject.com/pinax/trunk/bin/pinax-boot.py
python pinax-boot pinax-env
source pinax-env/bin/activate
pip install -r pinax-env/src/pinax/requirements/external_apps.txt
git clone git@github.com:ironfroggy/drinktale.git
""" Django command similar to 'loaddata' but also deletes.
After 'syncdata' has run, the database will have the same data as the fixture - anything
missing will of been added, anything different will of been updated,
and anything extra will of been deleted.
def attrs(**kwargs):
def _(f):
for (k, v) in kwargs.items():
setattr(f, k, v)
return f
return _
@attrs(author="ironfroggy")
def foo():
print foo.author
@ironfroggy
ironfroggy / forms.py
Created October 22, 2009 20:11
jquery.phototagging.js preview
# forms.py
class PhotoTagForm(forms.ModelForm):
class Meta:
model = PhotoTag
x = forms.IntegerField(widget=forms.HiddenInput())
y = forms.IntegerField(widget=forms.HiddenInput())
height = forms.IntegerField(widget=forms.HiddenInput())
width = forms.IntegerField(widget=forms.HiddenInput())
ul.horrow {
list-style: none;
overflow: hidden;
width: 100%;
padding: 0px;
margin: 0px;
}
{% from "macros.j2" import render_excerpt, render_post with context %}
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title>
{% block title %}{{ resource.meta.title|default(feed_title) }}{% endblock %}
</title>
{% block self_url %}
<link href="{{ resource.url }}" rel="self" />
{% endblock %}
class AsyncQueue(object):
def __init__(self):
self.q = []
self.ready = Future()
def push(self, value):
self.q.append(value)
yield self.ready(True)
/^(?!(?:do|if|in|for|let|new|try|var|case|else|enum|eval|false|null|this|true|void|with|break|catch|class|const|super|throw|while|yield|delete|export|import|public|return|static|switch|typeof|default|extends|finally|package|private|continue|debugger|function|arguments|interface|protected|implements|instanceof)$)[$A-Z\_a-z\xaa\xb5\xba\xc0-\xd6\xd8-\xf6\xf8-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ec\u02ee\u0370-\u0374\u0376\u0377\u037a-\u037d\u0386\u0388-\u038a\u038c\u038e-\u03a1\u03a3-\u03f5\u03f7-\u0481\u048a-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05d0-\u05ea\u05f0-\u05f2\u0620-\u064a\u066e\u066f\u0671-\u06d3\u06d5\u06e5\u06e6\u06ee\u06ef\u06fa-\u06fc\u06ff\u0710\u0712-\u072f\u074d-\u07a5\u07b1\u07ca-\u07ea\u07f4\u07f5\u07fa\u0800-\u0815\u081a\u0824\u0828\u0840-\u0858\u08a0\u08a2-\u08ac\u0904-\u0939\u093d\u0950\u0958-\u0961\u0971-\u0977\u0979-\u097f\u0985-\u098c\u098f\u0990\u0993-\u09a8\u09aa-\u09b0\u09b2\u09b6-\u09b9\u09bd\u09ce\u09dc\u09dd\u09df-\u09e1\u09f0\u09f1\u0a05-\u0a0a\u0a0f\u0a10\u0a13-\u0a28\u0a2a-\u
app.controller("MyCtrl", function($scope) {
// from right here, for example,
// where can 'element' come from?
$scope.ctx = element.getContext('2d');
});
app.factory('Doodles', function() {
var Doodles = [
];
return Doodles;
});
app.controller('DoodleListCtrl', function($scope, Doodles) {
var root = angular.element(document.querySelector('[ng-app]')).scope();
$scope.doodles = Doodles;