Skip to content

Instantly share code, notes, and snippets.

@epicserve
epicserve / Django Enviroment Setup on Mac OSX 10.6.2 (Snow Leopard).markdown
Created February 22, 2010 15:29
Django Enviroment Setup on Mac OSX 10.6.2 (Snow Leopard)

Django Enviroment Setup on Mac OSX 10.6.2 (Snow Leopard)

Install Homebrew

sudo mkdir /usr/local
sudo chown -R `whoami` /usr/local
curl -L http://github.com/mxcl/homebrew/tarball/master | tar xz --strip 1 -C /usr/local
brew install git
cd /usr/local
git init
@stephenemslie
stephenemslie / resolvermatch.py
Created February 3, 2011 12:35
Very simple but useful Django context processor to generate a ResolverMatch object from request.path and add this to the context. Handy in checking for active urls or namespaces.
"""
resolved_pattern Django context processor: insert the current url's ResolverMatch object into context.
Example use: Set class=active to a menu item, based on the namespace of the currently matched url.
<li {% if resolved.namespace == "home" %}class="active"{% endif %}> home </li>
or more specifically:
<li {% if resolved.view_name == "contact" %}class="active"{% endif %}> contact </li>
@gwik
gwik / zerologger.py
Created July 10, 2011 18:43
Python logger ZeroMQ, Gevent, CouchDB
# encoding: utf-8
"""
A python logging Handler that use ZeroMQ (ØMQ).
+------+ +------+ +-------+
| app1 | | app2 | | app X |
+------+ +------+ +-------+
| PUSH | PUSH | PUSH
| | |
@cspanring
cspanring / pagination.html
Created November 8, 2011 02:53
linaro django pagination template for Bootstrap framework
{# use in combination with https://github.com/zyga/django-pagination #}
{# and http://twitter.github.com/bootstrap/ #}
{# project-dir/templates/pagination/pagination.html #}
{% if is_paginated %}
{% load i18n %}
<div class="pagination">
<ul>
{% block previouslink %}
{% if page_obj.has_previous %}
@lamnk
lamnk / pypy_symlink.sh
Created December 12, 2011 00:17
Some symlinks needed to run pypy on CentOS 5.7 x64
@elidupuis
elidupuis / handlebars-helpers.js
Last active December 7, 2021 02:24
Simple Handlebars.js helpers
/*! ******************************
Handlebars helpers
*******************************/
// debug helper
// usage: {{debug}} or {{debug someValue}}
// from: @commondream (http://thinkvitamin.com/code/handlebars-js-part-3-tips-and-tricks/)
Handlebars.registerHelper("debug", function(optionalValue) {
console.log("Current Context");
console.log("====================");
#!/bin/sh
# Shell script to install your public key on a remote machine
# Takes the remote machine name as an argument.
# Obviously, the remote machine must accept password authentication,
# or one of the other keys in your ssh-agent, for this to work.
#
# http://www.devthought.com/2009/09/19/get-ssh-copy-id-in-mac-os-x/
#
@mbostock
mbostock / .block
Last active April 7, 2023 09:29
Static Force Layout
license: gpl-3.0
anonymous
anonymous / gist:2523336
Created April 29, 2012 02:01
Changing author info
#!/bin/sh
git filter-branch --env-filter '
an="$GIT_AUTHOR_NAME"
am="$GIT_AUTHOR_EMAIL"
cn="$GIT_COMMITTER_NAME"
cm="$GIT_COMMITTER_EMAIL"
if [ "$GIT_COMMITTER_EMAIL" = "your@email.to.match" ]
@ichord
ichord / gist:2786290
Created May 25, 2012 06:59
SAE storage for Django
# -*- coding: utf-8 -*-
import os, time, random
from django.core.files.base import File
from django.core.files.storage import Storage
from django.conf import settings
from django.core.files import File
import sae.storage
try:
from cStringIO import StringIO
except ImportError: