Skip to content

Instantly share code, notes, and snippets.

Avatar

Eric Skogen audionerd

View GitHub Profile
@audionerd
audionerd / atom-script-babel-upgrade.md
Created Feb 5, 2019
Using rgbkrk/atom-script and the latest version of Babel
View atom-script-babel-upgrade.md

Using the latest version of Babel with rgbkrk/atom-script

Update Babel CLI

cd ~/.atom/packages/script
npm uninstall --save-optional babel-cli
npm install --save-optional @babel/cli@latest
npm install --save-dev @babel/preset-env@latest
npm install --save-dev @babel/core@latest
@audionerd
audionerd / supersaw-shooter.scd
Last active Apr 8, 2021
SuperSaw (Roland JP-8000 and JP-8080) in SuperCollider
View supersaw-shooter.scd
// via https://www.nada.kth.se/utbildning/grukth/exjobb/rapportlistor/2010/rapporter10/szabo_adam_10131.pdf
(
{ | freq = 523.3572, mix=0.75, detune = 0.75 |
var detuneCurve = { |x|
(10028.7312891634*x.pow(11)) -
(50818.8652045924*x.pow(10)) +
(111363.4808729368*x.pow(9)) -
(138150.6761080548*x.pow(8)) +
(106649.6679158292*x.pow(7)) -
@audionerd
audionerd / xstate-react-hooks.js
Created Oct 31, 2018
using xstate with react hooks
View xstate-react-hooks.js
import React, { useState, useEffect, useMemo } from 'react'
import { Machine } from 'xstate'
import { interpret } from 'xstate/lib/interpreter'
const toggleMachine = Machine({
id: 'toggle',
initial: 'inactive',
states: {
inactive: {
on: { TOGGLE: 'active' }
View SketchSystems.spec
Idle
Artwork
Draw
Draw Idle
Draw Drawing
Marquee
Marquee Idle
Marquee Drawing Freeform
Marquee Drawing Line
Marquee Moving Artwork
View SketchSystems.spec
Workspace
text focus -> Text Entry Mode
toolbar marquee tool -> Marquee Selection Mode
Drawing Mode
pointerdown -> Drawing
pointerup -> Drawing Idle
option key & pointerdown -> Erasing
Drawing Idle*
Drawing
View truncateMiddle.lua
-- via https://stackoverflow.com/questions/5723154/truncate-a-string-in-the-middle-with-javascript
-- https://stackoverflow.com/questions/831552/ellipsis-in-the-middle-of-a-text-mac-style/36470401#36470401
function truncateMiddle (str, maxLength, separator)
maxLength = maxLength or 30
separator = separator or ""
if (maxLength < 1) then return str end
if (string.len(str) <= maxLength) then return str end
if (maxLength == 1) then return string.sub(str, 0, 1) .. separator end
@audionerd
audionerd / spout.lua
Created May 31, 2018
spout for norns
View spout.lua
-- spout.
--
-- key2 = sample A
-- key3 = sample B
-- enc2 = tempo
-- enc3 = rate selection
--
engine.name = 'Ack'
@audionerd
audionerd / index.js
Last active May 27, 2018
Callbags and Canceling with CAF
View index.js
require('regenerator-runtime/runtime')
import { forEach, map, pipe, fromEvent, scan } from 'callbag-basics'
import CAF from 'caf'
let source = pipe(
fromEvent(document, 'keydown'),
map(event => function * (signal) {
console.log('%cbegin', 'color:red')
yield CAF.delay(signal, 1000)
@audionerd
audionerd / .block
Last active Feb 26, 2017
Oscar Ballot Bingo 2017
We couldn’t find that file to show.
@audionerd
audionerd / react-native-widont.js
Created May 27, 2016
Widon’t for React Native
View react-native-widont.js
//
//
// Widon’t for React Native
// Simply uses Unicode \u00a0 instead of &nbsp;
//
// via http://webservices.blog.gustavus.edu/2007/03/20/shaun-inmans-widont-ported-to-javascript/
export const widont = (text) => text.replace(/([^\s])\s+([^\s]+)\s*$/, '$1\u00a0$2')