Skip to content

Instantly share code, notes, and snippets.

View literallylara's full-sized avatar
✌️

Lara Schütt literallylara

✌️
View GitHub Profile
/**
* A `Window.postMessage()` wrapper that aims to simplify the process of
* having two windows communicate with each other (see below for more details).
*
* @author Lara Sophie Schütt (@literallylara)
* @license MIT
* @version 1.0.5
*/
const SYNC_STATE_IDLE = 0b00000
export default {
"aliceblue": "#f0f8ff",
"antiquewhite": "#faebd7",
"aqua": "#00ffff",
"aquamarine": "#7fffd4",
"azure": "#f0ffff",
"beige": "#f5f5dc",
"bisque": "#ffe4c4",
"black": "#000000",
"blanchedalmond": "#ffebcd",
/**
* Calculates an element's bounds to any given
* layer/skin (content, padding, border margin).
*
* @author Lara Sophie Schütt (@literallylara)
* @license MIT
*
* @param {HTMLElement} el
* @param {object} [options]
/**
* A collection of utility functions for working with 2d geometry:
* Polygons, Segments, Lines & Points
*
* @author Lara Sophie Schütt (@literallylara)
* @license MIT
*/
/**
* @typedef {[x:Number,y:Number]} Point2D
/**
* Performs a recursive binary search upon the interval [min,max]
* where `getDirection()` determines the direction of the current value
* in relation to the reference value.
*
* Due to the properties of this algorithm,
* reaching the solution will always take less than `⌈log₂(max-min)⌉` steps.
*
* @author Lara Sophie Schütt (@literallylara)
* @license MIT
/**
* Performs a fuzzy search on a list of values (haystack)
* with the provided query (needle) and sorts each match
* based on its scoring.
*
* TODO: adjust scoring logic
*
* @author Lara Sophie Schütt (@literallylara)
* @license MIT
*
/**
* Promise wrapper for web workers.
*
* @author Lara Sophie Schütt (@literallylara)
* @license MIT
*/
export default class PromiseWorker
{
constructor(fn, ...args)
/**
* MIDI parser for JavaScript
* Reference: midi.org/specifications-old/item/the-midi-1-0-specification
*
* @author Lara Sophie Schütt (@literallylara)
* @license MIT
*/
const MIDI = {}
<canvas id=c style="border:1px solid"><script>
A = new AudioContext
C = c.getContext`2d`
a = A.createAnalyser()
s = A.createScriptProcessor(a.fftSize=b=1024,t=0,1)
s.connect(a)
a.connect(A.destination)

Index

Preface

Together with HellMood we won this year's (2016) JS1K competition and thought this might be a good opportunity to write about the development process and my motivation behind it. If you're already familiar with JS1K, feel free to skip the next two paragraphs.