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
# schemamigration | |
./manage.py schemamigration appname --auto --stdout # sanity check | |
./manage.py schemamigration appname --auto # generate migration script | |
# migrate | |
./manage.py migrate # database migration |
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
pip freeze | cut -d = -f 1 | xargs -n 1 pip search | grep -B2 'LATEST:' |
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
sudo python -m smtpd -n -c DebuggingServer localhost:1025 |
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
""" | |
Example of URL Patterns based on slug fields. | |
""" | |
from django.conf.urls.defaults import patterns, url | |
urlpatterns = patterns('', | |
url(r'^(?P<slug>[-\w]+)$', 'myapp.views.some_view', name="some_view"), | |
) |
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
<a href="{% url some_model object.slug %}">{{ object.name }}</a> | |
or | |
<a href="{{ object.get_absolute_url }}">{{ object.name }}</a> |
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 urlparse import urlparse | |
from cgi import parse_qs | |
import sys, re | |
RE_URL = re.compile('http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\(\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+') | |
for line in sys.stdin.readlines(): | |
try: | |
match = re.search(RE_URL, line) |
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
# Based on: http://springfans.com/ieeeSoftware/accChange.pdf | |
class DecisionTable(models.Model): | |
"""Decision Table""" | |
code = models.CharField(unique=True, max_length=8, verbose_name="Unique code for finding a decision table in code") | |
name = models.CharField(blank=True, max_length=100, verbose_name="User friendly name for decision table") | |
def __unicode__(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
; Date algorithms from... | |
; http://rjbaker.org.uk/software/datetime.html | |
; notleap(y)=[mod(y,4)+2)/3] | |
(defn NOTLEAP [y] | |
(TRUNC (/ (+ (mod y 4) 2) 3))) | |
; doy(y,m,d) = [275m/9] - [(m+9)/12] * (1+notleap(y) ) + d - 30 | |
; = \__p1__/ + (-1 * \___p2___/ * \_____p3____/ ) + d + -30 | |
(defn DAY_OF_YEAR [[y m d]] |
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
Uncaught Error: No protocol method ISeqable.-seq defined for type function: function () {cljsbinding.boot()} |
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
<html> | |
<body> | |
<form> | |
<input name="input1" bindatom="bindings.input1"> | |
<br/> | |
<input name="input2" bindatom="bindings.input2"> | |
<br/> | |
<input type="submit"> |