Skip to content

Instantly share code, notes, and snippets.

View dcocharro's full-sized avatar

Diogo Cocharro dcocharro

View GitHub Profile
@zeffii
zeffii / nodedemo.js
Created October 7, 2018 08:24
max msp node.script
const maxApi = require("max-api");
let x = 0;
let y = 0;
maxApi.addHandler("input", (dir) => {
switch (dir) {
case "UP":
y += 1;
@devilelephant
devilelephant / BeatBuddyWorldPercussionMidiChart.tsv
Created February 17, 2018 23:58
Beat Buddy World Percussion Midi Chart
Midi Note Note Name
85 C#5 Bongo Low - palm
84 C5 Bongo Low - closed slap
82 A#4 Shaker
75 D#4 Clave
59 B2 Splash2
57 A2 Hand Crash 2
56 G#2 Cowbell
55 G2 Splash 1
54 F#2 Tambourine
@jpillora
jpillora / combinations.js
Last active September 7, 2020 15:52
Array/String combinations in JavaScript
//Explaination:
// start with the empty set
// extract the head element
// copy each element in the set with the current head element appended
// recurse
var combinations = function(set) {
return (function acc(xs, set) {
var x = xs[0];
if(typeof x === "undefined")
@withakay
withakay / bjorklund.js
Created October 14, 2011 10:10
Bjorklund algorithm in JavaScript
/*
An implementation of the Bjorklund algorithm in JavaScript
Inspired by the paper 'The Euclidean Algorithm Generates Traditional Musical Rhythms'
by Godfried Toussaint

This is a port of the original algorithm by E. Bjorklund which I
found in the paper 'The Theory of Rep-Rate Pattern Generation in the SNS Timing Systems' by
E. Bjorklund.
@andrei-m
andrei-m / levenshtein.js
Last active January 12, 2024 23:00
Levenshtein distance between two given strings implemented in JavaScript and usable as a Node.js module
/*
Copyright (c) 2011 Andrei Mackenzie
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE