Skip to content

Instantly share code, notes, and snippets.

baob / gist:1389393
Created November 23, 2011 18:06
Activating Git completion for homebrew-installed git
ln -s /usr/local/git/contrib/completion/git-completion.bash /usr/local/etc/bash_completion.d/git
(unless of course /usr/local/etc/bash_completion.d/git already exists, in which case you shouldn't be reading this)
simonw / setting-up-sublime-text-2.txt
Created July 11, 2012 12:35
Setting up Sublime Text 2
First, install it from
Next, install the package control extension from here:
Installation instructions here:
Restart Sublime, then hit Shift+Apple+P and search for "Package Control: Install Package"
rob-b / post-checkout
Last active October 8, 2015 03:48 — forked from codysoyland/post-checkout
place in .git/hooks/post-checkout to delete empty directories and pyc files
#! /bin/sh
echo "Purging pyc files and empty directories..."
# Start from the repository root.
cd ./$(git rev-parse --show-cdup)
# Delete .pyc files and empty directories.
find . -name "*.pyc" -delete > /dev/null 2>&1 &
find . -type d -empty -delete > /dev/null 2>&1 &
matthewbelisle-wf / gist:3988391
Created October 31, 2012 17:12
App engine cron syntax validation
>>> import sys
>>> sys.path.append('/usr/local/google_appengine/')
>>> from dev_appserver import fix_sys_path
>>> fix_sys_path()
>>> from google.appengine.api.croninfo import GrocValidator
>>> GrocValidator().Validate('invalidsyntax')
Traceback (most recent call last):
File "<input>", line 1, in <module>
File "/Applications/", li
ne 78, in Validate
jaysw /
Created September 1, 2012 09:02
python virtualenvwrapper and SublimeCodeIntel plugin for Sublime Text integration
#!/usr/bin/env bash
# file: ~/.virtualenvs/postmkvirtualenv
# This hook is run after a new virtualenv is activated.
# setup python interpretor and sitepackages
# for Sublime Text's SublimeCodeIntel plugin.
# codeintel looks in the root of any folder opened via `subl foldername`
# for foldername/.codeintel/config
# it also looks in ~/.codeintel/config
olivergeorge /
Created July 22, 2015 11:04
Mixins to turn Django Rest Framework into a pull api Ref:
import six
from rest_framework import serializers, exceptions, parsers
class PullSerializerMixin(object):
pull_model = None
def __init__(self, *args, **kwargs):
self.pull_model = kwargs.pop('pull_model', self.pull_model)
super(PullSerializerMixin, self).__init__(*args, **kwargs)
obmarg /
Last active January 4, 2017 08:27
Google app engine python issue #7746 workaround
from toolz import concat
def page_iterator(query, page_size=999, **kwargs):
Returns an iterator over pages of a query.
Can be used to work-around the 1000 entity limit in remote_api_shell
:params query: The query we're using.
:params page_size: The page size to return.
:params qwargs: Additional options for fetch_page
asfaltboy /
Last active January 28, 2019 21:21
A simply SublimeText plugin to run a command if matches a selector
A simply SublimeText plugin to run a command if matches a selector.
Usage example - my `Default (OSX).sublime-mousemap`:
// for Python we use Anaconda's goto command, for go we use go_guru,
// for others we use built-in goto command
{ "button": "button1", "modifiers": ["ctrl"], "command": "mousemap_wrap",
"press_command": "drag_select", "args": { "commands": [
WebReflection / Function.prototype.notifier.js
Created November 7, 2011 18:08
A Function.prototype method handy to monitor "functions lifecycle"
Function.prototype.notifier = (function () {"use strict";
// (C) WebReflection - Mit Style License
function create(callback) {
function notifier() {
var args = [], output;
if (fire(notifier, "before", callback, this, args, null)) {
try {
output = callback.apply(this, args);
} catch(e) {
fire(notifier, "error", callback, this, args, e);
patrys /
Created September 17, 2010 11:59
Parametrized apps for Django
class AbstractMixin(object):
_classcache = {}
def contribute(cls):
return {}
def construct(cls, *args, **kwargs):
attrs = cls.contribute(*args, **kwargs)