⌘T | go to file |
⌘⌃P | go to project |
⌘R | go to methods |
⌃G | go to line |
⌘KB | toggle side bar |
⌘⇧P | command prompt |
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
DEFAULT_FILE_STORAGE = 'storages.backends.s3boto.S3BotoStorage' | |
STATICFILES_STORAGE = 'path.to.storage.S3StaticStorage' | |
THUMBNAIL_DEFAULT_STORAGE = 'storages.backends.s3boto.S3BotoStorage' | |
AWS_ACCESS_KEY_ID = 'YOUR KEY' | |
AWS_SECRET_ACCESS_KEY = 'YOUR KEY' | |
AWS_STORAGE_BUCKET_NAME = 'media.YOURSITE.com' | |
AWS_STATIC_BUCKET_NAME = 'static.YOURSITE.com' | |
AWS_S3_CUSTOM_DOMAIN = AWS_STORAGE_BUCKET_NAME | |
AWS_STATIC_CUSTOM_DOMAIN = AWS_STATIC_BUCKET_NAME | |
STATIC_URL = 'http://%s/' % AWS_STATIC_BUCKET_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
-- PostgreSQL 9.2 beta (for the new JSON datatype) | |
-- You can actually use an earlier version and a TEXT type too | |
-- PL/V8 http://code.google.com/p/plv8js/wiki/PLV8 | |
-- Inspired by | |
-- http://people.planetpostgresql.org/andrew/index.php?/archives/249-Using-PLV8-to-index-JSON.html | |
-- http://ssql-pgaustin.herokuapp.com/#1 | |
-- JSON Types need to be mapped into corresponding PG types | |
-- |
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 | |
from __future__ import absolute_import | |
"""Datetime utils. | |
To store time use `naive_to_utc(dt, tz_name)`. | |
To display time use `utc_to_local(dt, tz_name)`. | |
""" | |
import datetime as stdlib_datetime | |
import pytz |
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
var page = new WebPage(), | |
url = "http://kartograph.org/showcase/italia/", | |
output = "italia.pdf"; | |
page.viewportSize = { width: 1100, height: 750 }; | |
page.open(url, function (status) { | |
if (status !== 'success') { | |
console.log('Unable to load the address!'); | |
} else { |
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
var page = require('webpage').create(); | |
page.settings.loadImages = false; | |
page.onConsoleMessage = function(msg) { console.log(msg); }; | |
var pageUrl = 'http://www.bloggersentral.com/2010/08/how-put-add-adsense-on-blogger.html'; | |
var num = 0; | |
var max = 2; | |
page.onLoadFinished = function() { | |
var text = page.evaluate(function() { |
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
var page = require('webpage').create(); | |
page.settings.loadImages = false; | |
page.onConsoleMessage = function(msg) { console.log(msg); }; | |
page.onLoadFinished = function() { | |
page.evaluate(function() { | |
var getFrames = function(doc) { | |
var frames = doc.querySelectorAll('iframe'); | |
for (var i = frames.length - 1; i >= 0; i--) { | |
var fdoc = frames[i].contentWindow.document; |
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
virtualenv --no-site-packages . | |
source bin/activate | |
bin/pip install Django psycopg2 django-sentry | |
bin/pip freeze > requirements.txt | |
bin/django-admin.py startproject mysite | |
cat >.gitignore <<EOF | |
bin/ | |
include/ | |
lib/ | |
EOF |
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
LOGGING = { | |
'version': 1, | |
'disable_existing_loggers': False, | |
'handlers': { | |
'mail_admins': { | |
'level': 'ERROR', | |
'class': 'django.utils.log.AdminEmailHandler' | |
}, | |
'null': { | |
'level':'DEBUG', |
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
# | |
# Advanced Django 1.3.x+ Logging | |
# | |
# Author: | |
# Jason Giedymin < jasong _[_a-t_]_ apache d-o-t org > | |
# | |
# Description: | |
# A Django 1.3.x+ settings.py snippet with Advanced logging formatters using RFC 2822, | |
# TimedRotatingFileHandler, and a WatchedFileHandler. | |
# |
NewerOlder