Skip to content

Instantly share code, notes, and snippets.

@mbarto
mbarto / machine.js
Last active June 20, 2020 13:24
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@mbarto
mbarto / machine.js
Last active May 14, 2020 15:47
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@mbarto
mbarto / machine.js
Last active May 25, 2020 15:10
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@mbarto
mbarto / gist:ca4b80ddd550f629e74db061904309db
Created February 4, 2020 08:35
evenWord implementation
const isOdd = x => x % 2 === 1;
const toArray = s => s.split("");
const alpha = toArray("abcdefghijklmnopqrstuvwxyz");
const occurrences = (s, c) => toArray(s).filter(x => x === c).length;
const evenWord = s => alpha.map(c => occurrences(s, c)).filter(isOdd).length;
@mbarto
mbarto / legend
Created August 13, 2013 10:38
Geoserver print plugin legend sample
"legends":[
{
"name":"Admitting",
"color":"#00ffff",
"classes":[
]
},
{
@mbarto
mbarto / gist:6219558
Last active December 21, 2015 00:19
Geoserver print module call using curl
curl 'http://localhost:8080/geoserver/pdf/create.json' -H 'Content-Type: application/json' --data-binary '{"units":"degrees","srs":"EPSG:4326","layout":"A4 portrait","dpi":300,"outputFileName":"print","mapTitle":"USA States","comment":"This is a comment","layers":[{"type":"WMS","layers":["states"],"styles":[],"baseURL":"http://localhost:8080/geoserver/topp/wms","format":"application/pdf"}],"pages":[{"bbox":[-124.73142200000001,24.955967,-66.969849,49.371735],"rotation":0}],"legends":[]}'