Skip to content

Instantly share code, notes, and snippets.

(arraslife)alpha.local:~/P/k/a/arraslife [master*]
$ gondor run primary schemamigration timeline 0001 --fake
usage: gondor run [-h] instance_label command_ [cmdargs [cmdargs ...]]
gondor run: error: unrecognized arguments: --fake
@issackelly
issackelly / postactivate
Created July 4, 2011 18:51
Compass and CoffeeScript in Virtualenv
#!/bin/bash
# postactivate
# This hook is run after this virtualenv is activated.
cd ~/Projects/internal_kct/reb/
if [ "${OLDPATH}" == "" ]; then
echo "SETTING PATH"
export OLDPATH=$PATH
export PATH=$PATH:~/Projects/internal_kct/reb/bin/
fi
watch_coffee_sass
@issackelly
issackelly / gist:1075119
Created July 11, 2011 00:12
Show method_decorator on a Class Based View
from django.utils.decorators import method_decorator
from django.views.generic.base import TemplateView
from django.contrib.auth.decorators import login_required
class MaiView(TemplateView):
template_name = "mai/view.html"
@method_decorator(login_required)
def dispatch(self, request, *args, **kwargs):
{
"run_list": [
"main::default",
"main::python",
"main::nginx",
"main::munin",
"main::security",
"main::postgresql",
"main::postgis"
],
>>> def funkyTon(foo, bar, baz=None):
... return [i*i for i in range(foo, bar)]
...
>>> funkyTon(1, baz=3)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: funkyTon() takes at least 2 arguments (2 given)
>>>
@issackelly
issackelly / views.py
Created August 30, 2011 15:07
method_decorator around a Django Class Based View for login_required
from django.contrib.auth.decorators import login_required
from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect
from django.template.response import TemplateResponse
from django.utils.decorators import method_decorator
from django.views.generic.base import TemplateView
import datetime
from accounts.forms import NewAccountForm
@issackelly
issackelly / api.py
Created September 2, 2011 19:51
Project Model
class ProjectResource(ModelResource):
class Meta:
queryset = Project.objects.all()
@issackelly
issackelly / signing.coffee
Created September 17, 2011 14:31
Experimental implementation of Django Signing in JavaScript
base64 = require 'base64'
crypto = require 'crypto'
gzip = require 'gzip'
class BadSignature extends Error
constructor: (msg="Signature does not match") ->
super msg
class SignatureExpired extends BadSignature
constructor: (msg="Signature timestamp is older than required max_age") ->
def check_strange_installation():
default_exists = set([
'admin',
'displayRules',
'favicon.ico',
'index.php',
'resources',
'templates',
'variables.php',
'apple-touch-icon-72x72.png',
@issackelly
issackelly / pleaseread.markdown
Created May 27, 2012 23:44
What you can do about the Tastypie perms branch

Hey.

I know you'd like the perms branch merged into master. Here's what would be helpful:

  • Try it. Work with it in its current state and document any trouble you have. If there is a bug, the best thing you can do is write a test for it. Beyond that, writing a test and then a patch is great.
  • Use other methods. There's nothing in the perms branch that is groundbreaking, and you can apply permissions at several different spots already. Tastypie was designed to be extended, so you should be able to make the changes you need in your code. You should be able to get your work done without it.
  • Fork it, use something else, write your own.

What not to do: