Skip to content

Instantly share code, notes, and snippets.

View cspanring's full-sized avatar

Christian Spanring cspanring

View GitHub Profile
@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 / 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 / pip-install-gdal.md
Last active October 18, 2023 07:56
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:

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@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)
@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 / geojson-goes-ember.js
Last active December 14, 2015 16:19
Dabbling with GeoJSON and ember.js
// The GeoJSON object
//
// {
// "type": "FeatureCollection",
// "features": [
// {
// "type": "Feature",
// "geometry": {
// "type": "Point",
// "coordinates": [42.3875, -71.1]
@cspanring
cspanring / location_v2.json
Last active December 14, 2015 09:59
Urbanite Location Model
{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [ 0, 0 ]
},
"properties": {
"name": "NAME",
"bounded_box": {
"southwest": {
@cspanring
cspanring / cfa-boston-mapc-meetup.markdown
Created February 20, 2013 15:34
Notes from the CfA Boston Brigade meetup at MAPC.

CfA Brigade Boston Weekly Hack Night

Feb 19th, 2013 @ MAPC

MAPC Mission

The Metropolitan Area Planning Council (MAPC) is a regional planning agency serving the people who live and work in the 101 cities and towns of Metropolitan Boston. Our mission is promoting smart growth principles and regional collaboration.

Projects

@cspanring
cspanring / Nginx-domain-conf
Created January 26, 2013 01:00
Example Nginx and Gunicorn configurations for GeoNode deployment
server {
listen 80;
server_name mydomain.org;
root /var/www;
access_log off;
error_log /home/user/geonode/log/nginx_error.log;