Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / 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>
# 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 / 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" />
@walkermatt
walkermatt / confluence-table-to-csv.js
Last active February 21, 2018 11:42
Copy the data out of a Confluence table as CSV using Chrome devtools
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
walkermatt / scratch.js
Last active January 16, 2018 09:07
Ramda stuff
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},
];
This file has been truncated, but you can view the full file.
// OpenLayers. See https://openlayers.org/
// License: https://raw.githubusercontent.com/openlayers/openlayers/master/LICENSE.md
// 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