Skip to content

Instantly share code, notes, and snippets.

View cspanring's full-sized avatar

Christian Spanring cspanring

View GitHub Profile
@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:

@cspanring
cspanring / machine.js
Last active April 5, 2022 19:21
Generated by XState Viz: https://xstate.js.org/viz
const defaultFilters = ['defaultFilter']
const filterBarMachine = Machine(
{
id: 'filter-bar',
initial: 'idle',
context: {
filters: defaultFilters,
newFacet: undefined,
@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 / bike-rack.json
Created February 14, 2011 00:22
GeoJSON FeatureCollection example, geometry and properties.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import Ember from 'ember';
export default Ember.Component.extend({
tagName: ''
});
@cspanring
cspanring / launch.json
Created January 28, 2019 18:32
VS Code launch configuration to enable debugging Ember apps with Firefox. Requires Debugger for Firefox https://marketplace.visualstudio.com/items?itemName=hbenl.vscode-firefox-debug
{
"version": "0.2.0",
"configurations": [{
"name": "Launch Firefox",
"type": "firefox",
"request": "launch",
"reAttach": true,
"url": "http://localhost:4200",
"pathMappings": [{
"url": "http://localhost:4200/assets/YOUR-EMBER-APP-NAME",
@cspanring
cspanring / install-mapnik2.md
Created October 26, 2011 00:20
Mapnik2 on Ubuntu 10.04 installation

Mapnik2 on Ubuntu 10.04 installation

http://trac.mapnik.org/wiki/UbuntuInstallation

sudo apt-get install -y g++ cpp \
python-dev libxml2 libxml2-dev \
libfreetype6 libfreetype6-dev \
libjpeg62 libjpeg62-dev \
libltdl7 libltdl-dev \
libpng12-0 libpng12-dev \
@cspanring
cspanring / openlayers-click-handler.js
Created July 19, 2011 02:43
custom openlayers click handler compatible with touch events
// Create click handler
OpenLayers.Control.Click = OpenLayers.Class(OpenLayers.Control, {
defaultHandlerOptions: {
'single': true,
'double': false,
'pixelTolerance': 0,
'stopSingle': false,
'stopDouble': false
},
initialize: function(options) {
import Ember from 'ember';
export default Ember.Component.extend({
hasName: Ember.computed.notEmpty('name'),
actions: {
log(message) {
console.log(message);
}
}
});
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});