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
<html> | |
<head> | |
<style> | |
* { | |
margin: 0; | |
padding: 0; | |
} | |
.row span { | |
display: inline-block; | |
position: relative; |
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/bash | |
# file: gen.sh | |
# usage: ./gen.sh [name] | |
ROOT=rootCA | |
NAME=${1:-device} | |
EXTS=( key cnf csr crt ) | |
ROOT_NAME=rootCA | |
ROOT_EXTS=( key pem ) |
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
module.exports = function(grunt) { | |
grunt.initConfig({ | |
compass: { | |
// see configmerge.compass | |
}, | |
watch: { | |
// see configmerge.watch | |
} | |
configmerge: { | |
compass: { |
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
STATICFILES_STORAGE = 'pipeline.storage.PipelineStorage' | |
PIPELINE_COMPILERS = ( | |
'pipeline_compass.compass.CompassCompiler', | |
) | |
PIPELINE_CSS = dict(zip(PROJECT_APPS, [{ | |
'source_filenames': ( | |
(app + '/sass/*.scss'), | |
), |
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
## Print stack trace | |
def exception_printer(sender, **kwargs): | |
import sys, traceback | |
print >> sys.stderr, ''.join(traceback.format_exception(*sys.exc_info())) | |
raise | |
## Set breakpoint | |
import pdb | |
pdb.set_trace() |
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 TastypieApiKeyUserMiddleware(object): | |
""" | |
Middleware for per-request authentication with tastypie | |
""" | |
# Name of request header to grab username from. This will be the key as | |
# used in the request.META dictionary, i.e. the normalization of headers to | |
# all uppercase and the addition of "HTTP_" prefix apply. | |
header = 'HTTP_AUTHORIZATION' | |
method = 'apikey' | |
apikey_auth = ApiKeyAuthentication() |
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
;(function($, undefined) { | |
var PLUGIN_NAME = 'plugin'; | |
var DEFAULT_OPTIONS = { | |
optionA: true, | |
optionB: false, | |
'callbackC': function() { | |
} | |
}; | |
function plugin(options) { |
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
// CORS | |
app.use(function(req, res, next) { | |
if ('OPTIONS' !== req.method) { | |
if ('origin' in req.headers) { | |
res.setHeader('Access-Control-Allow-Origin', req.headers.origin); | |
} | |
next(); | |
} else { | |
var body = '{}\n'; | |
if ('origin' in req.headers) { |
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
Running 1 dyno. Does running more dynos get some better treament? | |
``` | |
2013-02-22T04:49:35+00:00 heroku[web.1]: Cycling | |
2013-02-22T04:49:38+00:00 heroku[web.1]: Stopping all processes with SIGTERM | |
2013-02-22T04:49:41+00:00 heroku[web.1]: Process exited with status 143 | |
2013-02-22T04:49:41+00:00 heroku[web.1]: State changed from up to down | |
2013-02-22T04:49:41+00:00 heroku[web.1]: State changed from down to starting | |
2013-02-22T04:49:46+00:00 heroku[web.1]: Starting process with command `newrelic-admin run-program python apps/manage.py runserver 0.0.0.0:40284 --noreload` | |
2013-02-22T04:49:47+00:00 app[web.1]: Validating models... |
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
# Say, you have models `Invoice` and `InvoicePart`. The `InvoicePart` | |
# has a non-nullable field of `Invoice`. | |
# | |
# Currently (August 2012), `tastypie` will throw an error when you try | |
# to create (`HTTP Post`) a new `Invoice` that contains one or more new | |
# `InvoicePart`. | |
# | |
# The problem is that when `tastypie` processes the `InvoicePart`, the | |
# backlink to `Invoice` is not set. | |
# |
NewerOlder