-
In your local_settings.py file:
DATABASES = { 'default': { 'ENGINE': 'django.db.backends.postgresql_psycopg2', 'NAME': 'django_%s' % (PROJECT_NAME,),
'USER': xxxx,
| # If you work with git, you've probably had that nagging sensation of not knowing what branch you are on. Worry no longer! | |
| export PS1="\\w:\$(git branch 2>/dev/null | grep '^*' | colrm 1 2)\$ " | |
| # This will change your prompt to display not only your working directory but also your current git branch, if you have one. Pretty nifty! | |
| # ~/code/web:beta_directory$ git checkout master | |
| # Switched to branch "master" | |
| # ~/code/web:master$ git checkout beta_directory | |
| # Switched to branch "beta_directory" |
| """ | |
| This module provides very simple Django middleware that sleeps on every request. | |
| This is useful when you want to simulate slow response times (as might be | |
| encountered, say, on a cell network). | |
| To use, add this middleware, and add a value for SLEEP_TIME to your settings. | |
| Possible future feature: Look for an X-Django-Sleep header on each request, | |
| to let the client specify per-request sleep time. |
| function nestCollection(model, attributeName, nestedCollection) { | |
| //setup nested references | |
| for (var i = 0; i < nestedCollection.length; i++) { | |
| model.attributes[attributeName][i] = nestedCollection.at(i).attributes; | |
| } | |
| //create empty arrays if none | |
| nestedCollection.bind('add', function (initiative) { | |
| if (!model.get(attributeName)) { | |
| model.attributes[attributeName] = []; |
| var fs = require("fs") | |
| var ssl_options = { | |
| key: fs.readFileSync('privatekey.pem'), | |
| cert: fs.readFileSync('certificate.pem') | |
| }; | |
| var port = process.env.PORT || 3000; | |
| var express = require('express'); | |
| var ejs = require('ejs'); | |
| var passport = require('passport') |
| class Application(tornado.web.Application): | |
| def __init__(self): | |
| tornado.web.Application.__init__(self, handlers, **settings) | |
| self.db_session = db_session | |
| self.redis = redis.StrictRedis() | |
| self.session_store = RedisSessionStore(self.redis) | |
| class BaseHandler(tornado.web.RequestHandler): |
Install ImageMagick for image conversion:
brew install imagemagick
Install tesseract for OCR:
brew install tesseract --all-languages
Or install without --all-languages and install them manually as needed.
| $(function () { | |
| "use strict"; | |
| // for better performance - to avoid searching in DOM | |
| var content = $('#content'); | |
| var input = $('#input'); | |
| var status = $('#status'); | |
| // my color assigned by the server | |
| var myColor = false; |
| #!/bin/bash | |
| echo "Generating an SSL private key to sign your certificate..." | |
| openssl genrsa -des3 -out myssl.key 1024 | |
| echo "Generating a Certificate Signing Request..." | |
| openssl req -new -key myssl.key -out myssl.csr | |
| echo "Removing passphrase from key (for nginx)..." | |
| cp myssl.key myssl.key.org | |
| openssl rsa -in myssl.key.org -out myssl.key |
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta charset="utf-8"> | |
| <title></title> | |
| <link rel="stylesheet" href="../libs/mocha.css" type="text/css" media="screen" title="no title" charset="utf-8"> | |
| </head> | |
| <body> | |
| <div id="mocha"></div> | |
| <script src="../libs/mocha.js" type="text/javascript" charset="utf-8"></script> |