This guide assumes a fresh install of Mac OSX 10.7 Lion.
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
[alias] | |
edit-unmerged = "!f() { git ls-files --unmerged | cut -f2 | sort -u ; }; $EDITOR `f`" | |
add-unmerged = "!f() { git ls-files --unmerged | cut -f2 | sort -u ; }; git add `f`" | |
lc = log ORIG_HEAD.. --stat --no-merges | |
smash = merge --no-commit --log | |
eat = branch -M | |
prune-all = !git remote | xargs -n 1 git remote prune | |
whois = "!sh -c 'git log -i --pretty=\"format:%an <%ae>\" --author=\"$1\" | sort -u' -" | |
whatis = show -s --pretty='tformat:%h (%s, %ad)' --date=short |
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
[alias] | |
# Git-tfs workflows | |
ct = tfs ct --build-default-comment | |
tfsrebase = !git stash && git checkout master && git tfs pull && git checkout @{-1} && git rebase master && git stash pop | |
tfsworkflow = !git checkout master && git tfs pull && git checkout @{-1} && git rebase master && git checkout master && git merge @{-1} --ff-only && git tfs ct --build-default-comment | |
# Github workflows | |
upmaster = !git checkout master && git fetch upstream && git merge upstream/master --ff-only && git push origin HEAD | |
uprebase = !git checkout master && git fetch upstream && git merge upstream/master --ff-only && git push origin HEAD && git checkout @{-1} && git rebase master |
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
from .base import * | |
try: | |
from .local import * | |
except ImportError: | |
pass |
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
from django.views.generic.base import View | |
class HttpMethodDependedView(View): | |
routes = { | |
} | |
def dispatch(self, request, *args, **kwargs): | |
method = request.method.lower() | |
if method in self.routes: |
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
# -*- coding: utf-8 -*- | |
import os | |
from optparse import make_option | |
import polib | |
from django.core.management import CommandError | |
from django.core.management.base import AppCommand | |
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 sh | |
## | |
# This is script with usefull tips taken from: | |
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx | |
# | |
# install it: | |
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh | |
# |
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
-- show running queries (pre 9.2) | |
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query | |
FROM pg_stat_activity | |
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%' | |
ORDER BY query_start desc; | |
-- show running queries (9.2) | |
SELECT pid, age(clock_timestamp(), query_start), usename, query | |
FROM pg_stat_activity | |
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%' |
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
ENV_BASE=env | |
REQUIREMENTS_DIR=test_requirements | |
define runtests | |
virtualenv-$1 $(ENV_BASE)-$1-$2 | |
$(ENV_BASE)-$1-$2/bin/pip install $(PIP_FLAGS) -r $(REQUIREMENTS_DIR)/django-$2.txt | |
$(ENV_BASE)-$1-$2/bin/python runtests.py $(TEST_FLAGS) | |
endef | |
all: py25dj13 py25dj14 py26dj13 py26dj14 py26djtrunk py27dj13 py27dj14 py26dj15 py27dj15 py33dj16 py26djtrunk py27djtrunk py33djtrunk |
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
from django.db import models | |
from django.db.models.query import QuerySet | |
class ChainableManager(models.Manager): | |
""" | |
A manager that allows chaining of all methods defined on it. | |
Example: | |
class MyManager(ChainableManager): |
OlderNewer