Skip to content

Instantly share code, notes, and snippets.

@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
(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
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-22349542-1']);
_gaq.push(['_trackPageview']);
var pageTracker;
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
@issackelly
issackelly / gist:947085
Created April 28, 2011 19:16
Beginning API Consumption
.. Proposal submission template for PyOhio 2011
.. Columbus, OH July 30 - 31, 2011
.. Information at http://pyohio.org or [email protected]
.. Submit by June 7, 2011 to [email protected]
.. Template uses reStructuredText format: http://docutils.sourceforge.net/rst.html
@issackelly
issackelly / gist:928783
Created April 19, 2011 16:48
Django Template {{ block.super }} example
# Template: A.html
<html>
<head></head>
<body>
{% block hello %}
HELLO
{% endblock %}
</body>
</html>
from django.conf import settings
import django.core.exceptions
from django.http import HttpResponsePermanentRedirect
from django.utils import translation
# TODO importing undocumented function
from django.utils.translation.trans_real import parse_accept_lang_header
from localeurl import settings as localeurl_settings
from localeurl import utils
# Make sure the default language is in the list of supported languages
"""/doc <something>: return python 2.7's documentation for <something>"""
import re
import importlib
import pydoc
from chatbot import send, p
#by default, render_doc uses shell escapes. Stop that.
class PlainTextDoc(pydoc.TextDoc):
def bold(self, x): return x
@issackelly
issackelly / gist:736712
Created December 10, 2010 19:56
How to use biblion tags in your template...untested
{% load biblion_tags %} <!-- at the top of the page -->
{% latest_blog_posts as posts %}<!-- gets 5 posts -->
{% for post in posts %}
{% if forloop.first %}
<h1><a href="{{ post.get_absolute_url }}">{{ post.title }}</a></h1>
{{ post.content_html|truncatewords_html:30 }}
{% else %}
<h3><a href="{{ post.get_absolute_url }}">{{ post.title }}</a></h3>
@issackelly
issackelly / gist:719568
Created November 29, 2010 04:12
brew install pyqt troubles
$ brew install pyqt
Warning: It appears you have MacPorts or Fink installed.
Software installed with MacPorts and Fink are known to cause problems.
If you experience issues try uninstalling these tools.
==> Downloading http://www.riverbankcomputing.co.uk/hg/sip/archive/4.11.2.tar.gz
######################################################################## 100.0%
==> Downloading patches
==> Patching
patching file build.py
patching file siputils.py
import pprint
class SqlDumpMiddleware(object):
def process_response(self, request, response):
from django.db import connection
pp = pprint.PrettyPrinter(indent=4)
pp.pprint(connection.queries)
return response