Skip to content

Instantly share code, notes, and snippets.

Drinking tea

Matt Walker walkermatt

Drinking tea
Block or report user

Report or block walkermatt

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
walkermatt /
Created Jun 4, 2012
A debounce function decorator in Python similar to the one in underscore.js, tested with 2.7
from threading import Timer
def debounce(wait):
""" Decorator that will postpone a functions
execution until after wait seconds
have elapsed since the last time it was invoked. """
def decorator(fn):
def debounced(*args, **kwargs):
def call_it():
walkermatt / web.config
Created Aug 15, 2014
Enable CORS IIS7
View web.config
<add name="Access-Control-Allow-Origin" value="*" />
<add name="Access-Control-Allow-Headers" value="Accept,Content-Type,X-Requested-With" />
# taken from
# generate server.pem with the following command:
# openssl req -new -x509 -keyout server.pem -out server.pem -days 365 -nodes
# change to the directory you want to serve and run as follows:
# python
# then in your browser, visit:
# https://localhost:4443
# to add the certificate to Chrome see:
import BaseHTTPServer
walkermatt / map.html
Created Sep 16, 2016
OpenLayers 3 LayerSwitcher and Popup together
View map.html
<!DOCTYPE html>
<meta charset="utf-8" />
<title>OpenLayers 3 - LayerSwitcher &amp; Popup</title>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width">
<link rel="stylesheet" href="" />
<link rel="stylesheet" href="" />
<link rel="stylesheet" href="" />
<link rel="stylesheet" href="" />
walkermatt / confluence-table-to-csv.js
Last active Feb 21, 2018
Copy the data out of a Confluence table as CSV using Chrome devtools
View confluence-table-to-csv.js
function escapeAsCsv(str) {
// Double up double quotes and quote the entire string if necessary
if (str.includes(',') || str.includes('\n') || str.includes('"')) {
return '"' + str.replace(/"/g, '""') + '"';
return str;
// Export Confluence table as CSV
// Select the tbody element in Chrome devtools Elements panel then run the
walkermatt /
Last active Jan 22, 2018
List of geometry type codes that can specified in an ogr gfs file.

OGR GFS Geometry Values

The geometry type of a feature class can be specified in a .gfs file used by OGR to map from a GML document to a simple feature schema. The following numbers can be used to specify a specific geometry type:

-2147483647 Point25D
-2147483646 LineString25D
-2147483645 Polygon25D
-2147483644 MultiPoint25D
-2147483643 MultiLineString25D
-2147483642 MultiPolygon25D
walkermatt / scratch.js
Last active Jan 16, 2018
Ramda stuff
View scratch.js
var R = require('ramda');
var states = [
{symbol: 'CT', name: 'Connecticut', pop: 3574097},
{symbol: 'ME', name: 'Maine', pop: 1328361},
{symbol: 'MA', name: 'Massachusetts', pop: 6547629},
{symbol: 'NH', name: 'New Hampshire', pop: 1316470},
{symbol: 'RI', name: 'Rhode Island', pop: 1052567},
{symbol: 'VT', name: 'Vermont', pop: 623741},
View ol-debug.js
This file has been truncated, but you can view the full file.
// OpenLayers. See
// License:
// Version: v4.5.0-70-gfca0b07
;(function (root, factory) {
if (typeof exports === "object") {
module.exports = factory();
} else if (typeof define === "function" && define.amd) {
define([], factory);
} else {
""" Minimal MapProxy Middleware demonstrating wrapping MapProxy and working
with the query string
To run:
1. Install MapProxy in a virtual enviroment together with Gunicorn
2. Create a basic MapProxy config and copy this file into the same directory as mapproxy.yaml
2. Activate virtual environment
3. Change to the directory containing this file
4. Run:
gunicorn -k eventlet --workers=1 --log-file=- mapproxy_filter:application
# Example of downloading all data from a GeoServer WFS server
# and loading it into a PostGIS database. Use with caution
# as you could put a lot of load on someone's server if they
# host a lot of data which might make them sad.
# In response to:
for LAYERNAME in `wget -qO- $BASEURL"&request=GetCapabilities" | xpath -q -e "//FeatureType/Name/text()"` ; do
You can’t perform that action at this time.