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
""" | |
In practice with four subclasses of LazyModelChoiceField | |
across a large project, we found existing __deepcopy__ based | |
alternatives such as | |
https://djangosnippets.org/snippets/2973/ | |
simply didn't work in all the circumstances we needed them to. | |
Tested against Python 2.7 and Python 3.4 with Django 1.6.8 | |
Hopefully this works for you too :) |
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
# For OSX Yosemite 10.10 `brew install postgres` [v9.3.5.1] | |
DATA_DIR='/usr/local/var/postgres/' | |
vi ${DATA_DIR}postgresql.conf | |
# Find log_statement in vi, then uncomment and set to 'all' | |
/log_statement | |
log_statement = 'all' | |
# Save / Exit vi | |
# Remember to set log_statement = 'none' when finished with debugging |
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 sys import exit | |
import os | |
os.environ['SYMPY_USE_CACHE'] = 'no' # 'yes', 'no', 'debug' | |
from sympy import * | |
x, y, a, t, x_1, x_2, z, s = symbols('x y a t x_1 x_2 z s') | |
def test_issue_4737(): |
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 -*- | |
""" | |
# usage: python mro_exploration.py | |
# https://github.com/pzrq/ | |
Better PyCharm mixin handling would make it far more useful for | |
Django Class-Based Views, Managers, and in contexts others have identified | |
such as Werkzeug. | |
https://youtrack.jetbrains.com/issue/PY-7712 |
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
def get_all_subclasses(python_class): | |
""" | |
Helper function to get all the subclasses of a class. | |
:param python_class: Any Python class that implements __subclasses__() | |
""" | |
python_class.__subclasses__() | |
subclasses = set() | |
check_these = [python_class] |
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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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
Albury | |
Armidale Regional | |
Ballina | |
Balranald | |
Bathurst Regional | |
Bayside | |
Bega Valley | |
Bellingen | |
Berrigan | |
Blacktown |