Skip to content

Instantly share code, notes, and snippets.

View walkermatt's full-sized avatar
💭
Drinking tea

Matt Walker walkermatt

💭
Drinking tea
View GitHub Profile
@walkermatt
walkermatt / map.html
Created September 16, 2016 17:47
OpenLayers 3 LayerSwitcher and Popup together
<!DOCTYPE html>
<html>
<head>
<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="https://cdnjs.cloudflare.com/ajax/libs/ol3/3.17.1/ol.css" />
<link rel="stylesheet" href="https://rawgit.com/walkermatt/ol3-layerswitcher/master/src/ol3-layerswitcher.css" />
<link rel="stylesheet" href="https://rawgit.com/walkermatt/ol3-layerswitcher/master/examples/layerswitcher.css" />
<link rel="stylesheet" href="https://rawgit.com/walkermatt/ol3-popup/master/src/ol3-popup.css" />
# taken from http://www.piware.de/2011/01/creating-an-https-server-in-python/
# 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 simple-https-server.py
# then in your browser, visit:
# https://localhost:4443
# to add the certificate to Chrome see:
# http://stackoverflow.com/a/15076602/526860
import BaseHTTPServer
@walkermatt
walkermatt / web.config
Created August 15, 2014 10:28
Enable CORS IIS7
<system.webServer>
<httpProtocol>
<customHeaders>
<add name="Access-Control-Allow-Origin" value="*" />
<add name="Access-Control-Allow-Headers" value="Accept,Content-Type,X-Requested-With" />
</customHeaders>
</httpProtocol>
</system.webServer>
@walkermatt
walkermatt / build.sh
Last active November 11, 2020 09:37
ol-layerswitcher migration to TypeScript presentation
npx @marp-team/marp-cli --template bare -o ol-layerswitcher-typescript.html presentation.md
@walkermatt
walkermatt / _talk-builds-tests-bugs-semver.md
Last active January 13, 2021 12:36
Talk on small contributions to open source software, testing, automated builds etc.

The day the build broke 😔

The tale of a broken build and breaking changes...


And so the story begins...

  • ol-ishare is built automatically each time a change is committed to the repository
    • Formatting of source code is checked (linting)
@walkermatt
walkermatt / README.md
Last active May 9, 2023 15:44
Example of requesting JSON data from a URL and converting to CSV

Download a JSON list of object and write to CSV

Requires Python 3.

Usage

Linux

python3 json_to_csv.py https://gist.githubusercontent.com/walkermatt/19b1108ca9bee94745810f4c39c32165/raw/cities.json /tmp/cities.csv
@walkermatt
walkermatt / bbox-to-wkt-polygon.js
Created August 16, 2015 15:04
Create WKT POLYGON from a bounding box in JavaScript
var str = "POLYGON((left top,right top,right bottom,left bottom,left top))";
var bbox = {left: 10, top: 30, right: 20, bottom: 40};
str.replace(/[a-z]+/g, function(s) {return bbox[s];});
@walkermatt
walkermatt / testutil.sql
Last active July 30, 2023 15:17
Postgres testing utilities
-- Raises an exception with `failure_message` if `sql_text` does not throw an exception at all.
-- If an exception is thrown but it's SQLSTATE doesn't match `expected_sql_state` then that
-- exception is RE-RAISED
CREATE OR REPLACE FUNCTION pg_temp.test__throws_exception(sql_text text, expected_sql_state text, failure_message text) RETURNS void AS $$
DECLARE
sql_state text;
BEGIN
EXECUTE sql_text;
RAISE EXCEPTION '%', failure_message;
EXCEPTION WHEN OTHERS THEN GET STACKED DIAGNOSTICS sql_state = RETURNED_SQLSTATE;
@walkermatt
walkermatt / foss4guk2023_foss4g2013_ten_years_after.md
Last active September 12, 2023 09:24
Note from FOSS4G UK 2023 "Ten Years After" talk

FOSS4G 2013 - Ten Years After

Matt Walker mattwalker@astuntechnology.com, x.com/_walkermatt

Data

Improved availability and visibility

  • Open data
    • OSM founded almost 10 years prior to FOSS4G 2013
  • Wide adoption; Humanitarian OSM (hotosm.org)