Skip to content

Instantly share code, notes, and snippets.

View cspanring's full-sized avatar

Christian Spanring cspanring

  • Crewbook
  • Somerville, MA
View GitHub Profile
@cspanring
cspanring / ha.js
Last active December 15, 2015 03:39
JavaScript gotchas - http://mistakes.io/#5195547
// primitive vs complex numbers
var nrComp = new Number(3);
var nrPrim = Number(3);
nrComp;
nrPrim;
nrComp === nrPrim;
nrComp == nrPrim;
typeof nrComp;
typeof nrPrim;
@cspanring
cspanring / django-json-example.py
Created April 15, 2013 15:38
Basic example for iterating over a Django queryset and returning JSON objects.
import json
from .models import MyModel
def get_json(request):
# Return JSON for filtered MyModel objects
records = MyModel.objects.filter(myproperty=myvalue)

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@cspanring
cspanring / pip-install-gdal.md
Last active September 24, 2026 14:33
Installing GDAL in a Python virtual environment

Installing GDAL in a Python virtual environment

Get gdal development libraries:

$ sudo apt-add-repository ppa:ubuntugis/ubuntugis-unstable
$ sudo apt-get update
$ sudo apt-get install libgdal-dev

Create and activate a virtual environment:

@cspanring
cspanring / sublime-text--2keyboard-shortcuts.rst
Last active December 18, 2015 02:59
Sublime Text 2 Keyboard Shortcuts for OS X

Editing

Keypress Command
⌘ + X Delete line
⌘ + ↩ Insert line after
@cspanring
cspanring / prototypal-inheritance-gotcha.js
Last active December 19, 2015 18:29
Prototypal inheritance gotcha in JavaScript - http://mistakes.io/#5999460
// Prototypal inheritance gotcha
var myProto = {
prop1: 'foo',
prop2: {
name: 'bar'
}
}
var obj1 = Object.create(myProto);
@cspanring
cspanring / .jshintrc
Created July 15, 2013 13:04
jshint config file
{
"node": true,
"browser": true,
"es3": true,
"esnext": true,
"bitwise": true,
"camelcase": true,
"quotmark": true,
"curly": true,
"eqeqeq": true,
@cspanring
cspanring / homebrew-qgis.md
Last active December 20, 2015 07:29
Homebrew hints for QGIS 1.8.0

Homebrew hints for QGIS 1.8.0

Qwt 6.1.0 upgrade is causing crashes or build problems
Downgrade to Qwt 6.0.1 and reinstall

$ brew remove qwt
$ git checkout 4392eba Library/Formula/qwt.rb
$ brew install qwt

QGIS shows SIP error messages on startup, indicating that QGIS is using the system Python instead of Homebrew's Python

@cspanring
cspanring / index.html
Created August 7, 2013 17:26
via:geojson.io
<!DOCTYPE html>
<html>
<head>
<meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no' />
<style>
body { margin:0; padding:0; }
#map { position:absolute; top:0; bottom:0; width:100%; }
.marker-properties {
border-collapse:collapse;
@cspanring
cspanring / index.html
Created August 7, 2013 17:31
via:geojson.io
<!DOCTYPE html>
<html>
<head>
<meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no' />
<style>
body { margin:0; padding:0; }
#map { position:absolute; top:0; bottom:0; width:100%; }
.marker-properties {
border-collapse:collapse;