Skip to content

Instantly share code, notes, and snippets.

View index.js
// This script is deprecated, use https://github.com/OverlappingElvis/blob-opera-midi instead!
const fs = require(`fs`)
const _ = require(`lodash`)
const { Player } = require(`midi-player-js`)
const blessed = require(`blessed`)
const contrib = require(`blessed-contrib`)
const Alea = require(`alea`)
const VOWELS = _.range(4)
View festive.json
{
"theme":"Festive",
"parts":[
{
"notes":[
{
"timeSeconds":0,
"midiPitch":69,
"librettoChunk":{
"vowel":{
View hanukkah.js
const allCandles = (new Array(256)).fill(256).map((val, index) => (index).toString(2).padStart(8, 0))
const nonsymmetricCandles = allCandles.reduce((memo, candles) => {
if (memo.includes([...candles].reverse().join(''))) {
return memo
}
memo.push(candles)
View demo.js
const chevrotain = require(`chevrotain`)
const { Lexer, Parser } = chevrotain
const allTokens = []
const createToken = (options) => {
const token = chevrotain.createToken(options)
allTokens.push(token)
@OverlappingElvis
OverlappingElvis / muggin.js
Created Sep 17, 2017
I'se A Muggin' (Part 2)
View muggin.js
/*
I really wanted my band to do this Mezz Mezzrow song (https://www.youtube.com/watch?v=UEQ6v0pWUcg) but nobody wanted to learn the sequence. Now they have no excuse.
*/
var _ = require('underscore');
// Folks, we're gonna do some muggin' with numbers. "Well explain it to me, man!"
var lessThanSeventy = function(number) {
if (number === 7) {
return 'uh';
@OverlappingElvis
OverlappingElvis / bathroom.js
Last active Aug 17, 2017
Is This Bathroom Occupied?
View bathroom.js
// underscore.js helpers
var _ = require('underscore');
// State aliases
var OCCUPIED = true;
var VACANT = false;
// Sample a current state
var knock = function(state) {
var correct = state.sign === state.bathroom;