Skip to content

Instantly share code, notes, and snippets.

from snake import *
@task
@depends_on('virtualenv.create', 'install')
def init():
pass
@task
Mailer.send(
sender = '[email protected]',
recipients = ['[email protected]', '[email protected]'],
context_data = {'site': site},
template_name = 'mailer/messages/message')
ModelMailer.send(
object = message,
request = request,
func(one, two,
three, four)
# or
func(
one, two,
three, four)
@yumike
yumike / app.py
Created November 30, 2011 06:36
Flask app with Gears
from flask import Flask
from flask_gears import Gears
app = Flask(__name__)
gears = Gears()
gears.init_app(app)
@yumike
yumike / blocks.py
Created December 8, 2011 06:45
Thoughts about RSpec for Python
# codec: blocks
describe('articles.views.ArticleView'):
context('when user has permissions'):
it('should add new article'):
# some code
it('should delete existing article'):
from django.utils import simplejson as json
class JSONRequestMixin(object):
def get_request_data(self):
return json.loads(self.request.body)
@yumike
yumike / requirements.txt
Created February 1, 2012 13:27
Better pip requirements file format with indented dependencies (already working)
Django==1.3.0
django-celery==2.2.4
celery==2.2.7
anyjson==0.3.1
kombu==1.2.0
amqplib==1.0.0
python-dateutil==1.5
django-picklefield==0.1.9
django_compressor==1.1.2
django-appconf==0.4.1
class Article extends Publication
initialize: (@title, @content) ->
render: ->
@$(".title").html @title
@$(".content").html @content
{% load tree_tag %}
{% tree object_list with level as level %}
<ul{% ifequal tree.level 1 %} class="root"{% endifequal %}>
{% node %}
<li>{{ tree.node.title }}{% subtree %}</li>
{% endnode %}
</ul>
{% endtree %}