Skip to content

Instantly share code, notes, and snippets.

jQuery templates use constructs like:
{{if condition}} print something{{/if}}
This, of course, completely screws up Django templates,
because Django thinks {{ and }} mean something.
Wrap {% verbatim %} and {% endverbatim %} around those
blocks of jQuery templates and this will try its best
hgmnz / query_planner.markdown
Created Mar 23, 2011
PostgreSQL query plan and SQL performance notes
View query_planner.markdown

Types of index scans


Sequential Scan:

  • Read every row in the table
  • No reading of index. Reading from indexes is also expensive.
kevinSuttle /
Last active Oct 17, 2020 — forked from lancejpollard/
List of Usable HTML Meta and Link Tags
jiaaro / simpleTarget.js
Last active Dec 16, 2015
Partially de-obfuscated simpleTarget() from
View simpleTarget.js
// library function…
// o.lib.targeting.simpleTarget(ship, pos)
// mostly deobfuscated/deminified
function simpleTarget(ship, pos) {
var i, r, h,
torque = 0,
thrust = 0,
dir = o.lib.targeting.dir(ship, pos);
jiaaro / script.bash
Created Apr 24, 2013
Embed Python in a bash script
View script.bash
export FOO=100
python - <<END
import os
print "foo:", os.environ['FOO']
BurntCaramel / example.playground
Created Jul 13, 2014
Using enum for getting/setting value and modification date – Inessential · Swift Structs and valueForKey:
View example.playground
import Swift
import Cocoa
// Properties you need as an enum - problem of key value coding is it allows you to type *anything*, typos compile fine.
enum SyncObjectPropertyName {
case Archived
case Title
// Protocol shared both for local and server
natecook1000 / randomInt.swift
Created Oct 9, 2014
Random integers without shuttling between UInt32 and Int
View randomInt.swift
func arc4random_uniform<T: SignedIntegerType>(max: T) -> T {
let max32: Int32 = numericCast(max)
return T(Int64(arc4random_uniform(UInt32(max32))))
func arc4random_uniform<T: UnsignedIntegerType>(max: T) -> T {
let max32: UInt32 = numericCast(max)
return T(UInt64(arc4random_uniform(max32)))
natecook1000 / NSTimer+Closure.swift
Last active Aug 1, 2019
Scheduled NSTimer with a Swift closure
View NSTimer+Closure.swift
extension NSTimer {
Creates and schedules a one-time `NSTimer` instance.
- Parameters:
- delay: The delay before execution.
- handler: A closure to execute after `delay`.
- Returns: The newly-created `NSTimer` instance.
marcoarment /
Created Feb 13, 2015
Encode a podcast with metadata using command-line LAME
# Encode a WAV to a finalized podcast MP3 with metadata, in the current directory
# Requires lame
# With Homebrew on Mac OS X: brew install lame
You can’t perform that action at this time.