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
Mozilla/5.0 (iPad; U; CPU OS 3_2 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Version/4.0.4 Mobile/7B334b Safari/531.21.10 |
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
cat > filemane |
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 KeepQueryStringModelAdmin(admin.ModelAdmin): | |
""" | |
A ModelAdmin that "fixes" the default behavior of redirecting to the | |
default change list after a save. | |
This class remembers the change list query string that was used for the | |
change list and redirects to it after a save, maintaining the ordering, | |
filtering, & pagination. | |
Thanks to Vlada Macek http://djangopeople.net/tuttle/ | |
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
# Django virtualenv helpers | |
VIRTUALENV_PROJECTS=~/projects | |
# work on virtualenv | |
function workon(){ | |
cd $VIRTUALENV_PROJECTS/$1 | |
source bin/activate | |
} | |
# Run Django management commands |
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
// highlight and fade background on named anchors | |
// requires jquery.color.js http://plugins.jquery.com/project/color | |
function highlight(elemId){ | |
var elem = $(elemId); | |
elem.css("backgroundColor", "#ffffff"); // hack for Safari | |
elem.animate({ backgroundColor: '#ffffaa' }, 1500); | |
setTimeout(function(){$(elemId).animate({ backgroundColor: "#ffffff" }, 3000)},1000); | |
} | |
if (document.location.hash) { |
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
import os, sys | |
import site | |
# put virtualenv on pythonpath | |
site.addsitedir('/path/to/project/ve/lib/python2.5/site-packages') | |
# redirect prints to apache log | |
sys.stdout = sys.stderr | |
os.environ['DJANGO_SETTINGS_MODULE'] = 'myproject.settings' |