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 upper_case_name(obj): | |
raise AttributeError # ignored! | |
class PersonAdmin(admin.ModelAdmin): | |
list_display = (upper_case_name,) |
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 python | |
# coding: utf-8 | |
""" | |
Python web handler test | |
~~~~~~~~~~~~~~~~~~~~~~~ | |
Detect web handler: mod_wsgi, fast_CGI, mod_python or CGI and display many informations | |
You should check if the shebang is ok for your environment! |
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 field in new_entry._meta.local_fields: | |
if field.name == "lastupdatetime": | |
field.auto_now = False | |
elif field.name == "createtime": | |
field.auto_now_add = False | |
new_entry.createtime = date | |
new_entry.lastupdatetime = date | |
new_entry.save() |
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 time | |
import Tkinter as tkinter | |
WIDTH = 320 | |
HEIGHT = 240 | |
LEFT = -2 | |
RIGHT = 0.5 | |
TOP = 1.25 |
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_processinfo import app_settings as PROCESSINFO | |
PROCESSINFO.INFO_FORMATTER = "<!-- django-processinfo: %(own).1f ms of %(total).1f ms (%(perc).1f%%) -->" |
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
-- | |
-- copyleft (c) 2012 by htFX, Jens Diemer - http://www.htFX.de | |
-- | |
-- https://gist.github.com/2392735 | |
-- http://www.scriptspot.com/3ds-max/scripts/maxscript-to-turn-off-backface-cull-on-all-objects | |
-- | |
actionMan.executeAction 0 "40472" -- MAX Script: MAXScript Listener | |
clearListener() |
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
actionMan.executeAction 0 "40472" -- MAX Script: MAXScript Listener | |
clearListener() | |
trackIndex = 1 | |
m = trackViewNodes[trackIndex] | |
while (m != undefined) do | |
( | |
print trackIndex | |
windows.processPostedMessages() |
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/sh | |
# more info here: http://www.pylucid.org/permalink/410/runserversh | |
# use the local django packages | |
export PYTHONPATH=${PWD} | |
PORT='8000' |
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
""" | |
http://www.python-forum.de/viewtopic.php?f=1&t=29222 | |
""" | |
import difflib | |
from itertools import izip_longest, tee | |
def compare(first, second): |
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
class PersonModel(models.Model): | |
name = models.CharField(max_length=128) | |
friends = models.ManyToManyField("self", blank=True, null=True) | |
def __unicode__(self): | |
return "Person '%s'" % self.name | |
# ------------------------------------------------------------ | |
p1 = PersonModel(name="paul") | |
p1.save() |