mkdir -p ~/bin ~/lib/python2.6/site-packages
Configure the environment by putting something like this in your
.bashrc
and sourcing it:export CFLAGS=-I/usr/local/pgsql/include export LDFLAGS=-L/usr/local/pgsql/lib
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# http://henrik.nyh.se/2008/12/git-dirty-prompt | |
# http://www.simplisticcomplexity.com/2008/03/13/show-your-git-branch-name-in-your-prompt/ | |
# username@Machine ~/dev/dir[master]$ # clean working directory | |
# username@Machine ~/dev/dir[master*]$ # dirty working directory | |
function parse_git_dirty { | |
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "*" | |
} | |
function parse_git_branch { | |
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/[\1$(parse_git_dirty)]/" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | |
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
h scroll left | |
j scroll down | |
k scroll up | |
l scroll right | |
gg scroll to top of the page | |
G scroll to bottom of the page | |
f activate link hints mode to open in current tab | |
F activate link hints mode to open in new tab | |
r reload |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
""" | |
Use pip to get a list of local packages to check against one or more package | |
indexes for updated versions. | |
""" | |
import pip | |
import sys, xmlrpclib | |
from cStringIO import StringIO | |
from distutils.version import StrictVersion, LooseVersion |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Split a array into semi-equal sized chunks. | |
* A so-called 'columnizer' | |
* | |
* @param array $array The array to split | |
* @param array $numberOfChunks The number of chunks | |
* @param bool $vertical Whether to order vertically or horizonally | |
* | |
* @return array Array with $numberOfColumns nodes with items of $array |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function add_inline_form(prefix) { | |
var count = parseInt($('#id_' + prefix + '-TOTAL_FORMS').val(), 10); | |
var last_form = $('.' + prefix + ':last'); | |
var new_form = last_form.clone(false).html(last_form.html().replace( | |
new RegExp(prefix + '-\\\\d-', 'g'), prefix + '-' + count + '-')); | |
new_form.find('input[type="text"], textarea').each(function () { | |
$(this).val(''); | |
}); | |
new_form.hide().insertAfter(last_form).slideDown(300); |
#Stay Standalone
A short script to prevent internal links to a "webapp" added to iPhone home screen to open in Safari instead of navigating internally.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class YourResource(ModelResource): | |
def wrap_view(self, view): | |
""" | |
Wraps views to return custom error codes instead of generic 500's | |
""" | |
@csrf_exempt | |
def wrapper(request, *args, **kwargs): | |
try: |
OlderNewer