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 -*- | |
# This hack adds a new Meta option "db_column_prefix". If not None all | |
# database columns in a model will be prepended with this prefix (the | |
# database columns, not the attributes). See Person model for an | |
# example. | |
# | |
# Issues: | |
# - How to set a prefix for a m2m table? - If "through" argument is | |
# not specified on a M2MField, Django automatically adds a model |
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
# Regex to extract error messages from "pylint -f parseable" output | |
import re | |
P_PYLINT_ERROR = re.compile(r""" | |
^(?P<file>.+?):(?P<line>[0-9]+):\ # file name and line number | |
\[(?P<type>[a-z])(?P<errno>\d+) # message type and error number, e.g. E0101 | |
(,\ (?P<hint>.+))?\]\ # optional class or function name | |
(?P<msg>.*) # finally, the error message | |
""", re.IGNORECASE|re.VERBOSE) |
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
;;; closure-gjslint.el --- Closure Lint mode | |
;; Copyright (C) 2011 Andi Albrecht | |
;; Author: Andi Albrecht <[email protected]> | |
;; Keywords: | |
;; This program is free software; you can redistribute it and/or modify | |
;; it under the terms of the GNU General Public License as published by | |
;; the Free Software Foundation, either version 3 of the License, or |
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 python2 | |
# git-branch-io -- show incoming and outgoing commits | |
# | |
# Place this file somewhere in your PATH. | |
# | |
# Usage: git branch-io [branch] | |
# | |
# If branch is not given the current branch will be used. The script | |
# prints out how many commits should go in either direction to bring |
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
;;; python-flake8.el --- Thin wrapper around python-pylint to run flake8 | |
;; Copyright (C) 2011 Andi Albrecht | |
;; Author: Andi Albrecht <[email protected]> | |
;; Keywords: languages | |
;; This program is free software; you can redistribute it and/or modify | |
;; it under the terms of the GNU General Public License as published by | |
;; the Free Software Foundation, either version 3 of the License, or |
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
try: | |
from collections import OrderedDict | |
except ImportError: | |
OrderedDict = None | |
from UserDict import UserDict | |
if OrderedDict is not None: | |
class Cache(OrderedDict): | |
def flush(self): |
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
#!/bin/bash | |
# A hacky command for a common task: | |
# - stash away all changes in working branch | |
# - update master from SVN | |
# - rebase working branch on master | |
# - flush all committed changes from working branch to master | |
# - push them to SVN | |
# - update working branch again | |
# - patch in changes |
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 python3 | |
# This script demonstrates a custom TreeModel (known as | |
# GenericTreeModel in PyGtk 2). | |
# | |
# Note: This script requires python-gi (pygobject) >= 3.4. | |
from gi.repository import GObject, Gtk | |
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
application: your-app-id | |
version: 1 | |
runtime: python27 | |
api_version: 1 | |
threadsafe: true | |
handlers: | |
- url: /.* | |
script: demo.application |
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 -*- | |
"""Set up an interactive interpreter to have a underlying tulip loop. | |
The setup() function replaces the default loop policy, that starts a loop only | |
for the main thread, by a policy that has a single global loop available in any | |
thread. | |
The loop will be started when calling setup() in a background thread so that | |
the main thread could still be used by the interactive shell. |
OlderNewer