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
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
{ | |
"react": "https://esm.sh/@preact/compat", | |
"use-isomorphic-layout-effect": "https://esm.sh/*use-isomorphic-layout-effect?alias=react:preact/compat&deps=react", | |
"use-sync-external-store/": "https://esm.sh/*use-sync-external-store/", | |
"use-subscription": "https://esm.sh/*use-subscription?alias=react:preact/compat&deps=react", | |
"xstate": "https://esm.sh/*xstate@4.37.0?alias=react:preact/compat&deps=react", | |
"@xstate/react": "https://esm.sh/*@xstate/react@2.0.1?alias=react:preact/compat&deps=react" | |
} |
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
// M5Stack Core Basic + RCA Module 13.2 (PCM5102) | |
// based on https://github.com/m5stack/M5Stack/blob/b3e801f/examples/Unit/RCA/RCA.ino | |
#include <M5Unified.h> | |
void setup() { | |
auto cfg = M5.config(); | |
cfg.external_spk = true; | |
cfg.internal_spk = 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
// via https://web.archive.org/web/20191104212834/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)) - |
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
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' } |
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
Idle | |
Artwork | |
Draw | |
Draw Idle | |
Draw Drawing | |
Marquee | |
Marquee Idle | |
Marquee Drawing Freeform | |
Marquee Drawing Line | |
Marquee Moving Artwork |
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
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 |
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
-- 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 |
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
-- spout. | |
-- | |
-- key2 = sample A | |
-- key3 = sample B | |
-- enc2 = tempo | |
-- enc3 = rate selection | |
-- | |
engine.name = 'Ack' |
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
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) |
NewerOlder