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
// there's got to be a better name for this function | |
const analyze = (xForms, data) => Object.keys(xForms).reduce( | |
(acc, key) => Object.assign(acc, {[key]: xForms[key](data)}), | |
{} | |
) | |
// it allows application of multiple transformations to a single value | |
// and combines the results of those transformations into a single object | |
const rectangleSideLengths = [3, 4] | |
const area = ([a, b]) => a * b |
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
// imlazy show and tell | |
// utils | |
const compose = (...fns) => x => fns.reduceRight((acc, f) => f(acc), x) | |
const log = (x, ...xs) => (console.log(...[x + ':', '\n', ...xs, '\n'])) | |
// Generator expression | |
const oneTwoThreeGenerator = function * () { | |
yield 1 | |
yield 2 |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>WASM</title> | |
<style> | |
html { | |
height: 100%; | |
} | |
body { |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="theme-color" content="{{ themeColor }}"> | |
<meta name="viewport" content="initial-scale=1, width=device-width"> | |
<title>{{ title }}</title> | |
<script defer src="index.js"></script> | |
<link href="style.css" rel="stylesheet"> | |
</head> |
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
{ | |
"editor.minimap.enabled": false, | |
"editor.scrollBeyondLastLine": false, | |
"editor.tabSize": 2, | |
"editor.wordWrap": "on", | |
"explorer.confirmDelete": false, | |
"explorer.confirmDragAndDrop": false, | |
"editor.accessibilitySupport": "off", | |
"editor.formatOnSave": true, | |
"extensions.ignoreRecommendations": false, |
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
init-license=MIT | |
init.author.name=Ben Hall | |
init.version=0.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 crypto = require('crypto') | |
const computeHash = data => | |
crypto | |
.createHash('md5') | |
.update(data) | |
.digest('base64') | |
.replace(/\+/g, '-') | |
.replace(/\//g, '_') | |
.replace(/=+$/, '') |
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 audioCtx = new AudioContext | |
const gain = audioCtx.createGain() | |
gain.connect(audioCtx.destination) | |
gain.gain.value = 0.2 | |
const noteDuration = 0.2 | |
const notes = [ | |
[659.25, 1], [659.25, 1], [659.25, 2], | |
[659.25, 1], [659.25, 1], [659.25, 2], | |
[659.25, 1], [783.99, 1], [523.25, 1], [587.33, 1], | |
[659.25, 4], |