This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"version": 8, | |
"name": "versatiles-colorful", | |
"metadata": { | |
"maputnik:renderer": "mbgljs", | |
"license": "https://creativecommons.org/publicdomain/zero/1.0/" | |
}, | |
"sources": { | |
"versatiles-shortbread": { | |
"tilejson": "3.0.0", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const httpclient = require('ringo/httpclient'); | |
const files = require('ringo/utils/files'); | |
const fs = require('fs'); | |
const {command} = require('ringo/subprocess'); | |
const {toot} = require('mastodon-api'); | |
// wien | |
/* | |
const left=16.18; | |
const bottom=48.11; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const reversedCopy = (array) => { | |
array = Array.from(array); | |
array.reverse(); | |
return array; | |
} | |
const multiply = (array) => array.reduce((prev, curr) => prev * curr); | |
const flatten = (arr) => { | |
return arr.reduce(function (flat, toFlatten) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// reduce function returning all directories bigger than 100K | |
const reduceToBiggerThan = (list, directory) => { | |
if (directory.size <= 100 * 1000) { | |
list.push(directory); | |
} | |
directory.children.reduce(reduceToBiggerThan, list); | |
return list; | |
} | |
// reduce to the smallest directory that is bigger than the neededSpace |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const findSignal = (count, inputString) => { | |
const inputChars = inputString.split('') | |
const markerStartIdx = inputChars.findIndex((_, idx) => { | |
const chars = inputChars.slice(idx, idx + count); | |
const set = new Set(chars); | |
if (set.size === count) { | |
return true; | |
} | |
}) | |
return markerStartIdx + count; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const parse = (inputString) => { | |
const lines = inputString.split('\n'); | |
return lines.map(line => { | |
const parts = line.split(','); | |
const partsA = parts[0].split('-').map(i => parseInt(i)); | |
const partsB = parts[1].split('-').map(i => parseInt(i)); | |
return { | |
a: { | |
from: partsA[0], | |
to: partsA[1] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const parse = (inputString) => { | |
const lines = inputString.split('\n'); | |
const crateLines = lines.slice(0,8); | |
const moveLines = lines.slice(10); | |
const crates = []; | |
crateLines.forEach(crateLine => { | |
let columnIdx = 0; | |
for (let i=1;i<crateLine.length-1;i+=4) { | |
let crateChar = crateLine.slice(i, i+1); | |
crates[columnIdx] = crates[columnIdx] || []; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const sum = (array) => array.reduce((prev, curr) => prev + curr); | |
const intersect = (setA, setB) => new Set(Array.from(setA).filter(i => setB.has(i))); | |
const charsToSet = (chars) => new Set(chars.split('')); | |
// Array.flat | |
const flatten = (array, ret) => { | |
ret = ret || []; | |
return array.reduce((ret, entry) => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const ROCK = 0; | |
const PAPER = 1; | |
const SCISSORS = 2; | |
const LOOSE = 0; | |
const DRAW = 1; | |
const WIN = 2; | |
const sum = (array) => array.reduce((prev, curr) => prev + curr); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const ROCK = 'rock'; | |
const PAPER = 'paper'; | |
const SCISSORS = 'scissors'; | |
const LOOSE = 'loose'; | |
const DRAW = 'draw'; | |
const WIN = 'win'; | |
const sum = (array) => array.reduce((prev, curr) => prev + curr); |
NewerOlder