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 settings for stackoverflow project. | |
from os.path import abspath, dirname, join | |
PROJECT_ROOT = abspath(dirname(dirname(__file__))) | |
root = lambda *args: join(abspath(PROJECT_ROOT), *args) | |
DEBUG = True | |
TEMPLATE_DEBUG = DEBUG | |
ADMINS = ( |
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 name in `ls *.jpg` | |
do | |
convert -resize 930x $name ../Images-small/$name | |
done |
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
find . -name "*.jpg" -print |sed 's/\(.*\)-big\(.*\)/mv & \1\2/' | sh |
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
location ~ \.(eot|svg|ttf|woff|otf)$ { | |
valid_referers blocked mysite.com *.mysite.com; | |
if ($invalid_referer) { | |
return 403; | |
} | |
} |
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 manage.py dumpdata --indent 2 content.PageType content.ColumnType content.BlockType > initial_data.json |
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
# change commit message after commit | |
hg commit --amend | |
# undo add before commit | |
hg revert [file_name|directory_name] | |
# create new branch | |
hg branch new-branch-name | |
# push new branch to remote |
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 os import listdir | |
from os.path import isfile, join | |
mypath = '.' | |
prepend = '<a href=""><img src="' | |
append = '"></a>' | |
onlyfiles = [ f for f in listdir(mypath) if isfile(join(mypath,f)) ] | |
html_tags = [prepend + f + append for f in onlyfiles] |
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
# create directory to hold translation message files | |
mkdir locale/en/LC_MESSAGES/ | |
# create messages | |
python manage.py makemessages -l en | |
# compile messages | |
python manage.py compilemessages |
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
-- Change password for user to specific database | |
-- Create database | |
create database mydb; | |
-- Select database | |
use mydb; | |
-- Create user | |
CREATE USER 'myuser'@'localhost' IDENTIFIED BY 'mypassword'; |
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
attachResizeListener: function () { | |
$(window).on('resize', this.resizer.bind(this)); | |
}, | |
resizer: function () { | |
if (this.scroller !== undefined) { | |
this.scroller.dispose(); | |
this.scroller = undefined; | |
} | |
var $wrapper = $('.wrapper'); |
OlderNewer