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 faker from 'faker' ; | |
function fakeOrg(){ | |
const namePersonOrOrg = (Math.random() < 0.5) | |
? faker.name.firstName() +' '+ faker.name.lastName() | |
: faker.company.companyName() | |
console.log(namePersonOrOrg) | |
return { | |
name: namePersonOrOrg, | |
// card: faker.helpers.userCard(), |
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
const volumeMachine = Machine({ | |
id: 'volume', | |
initial: 'init', | |
context: { | |
volume: 0.7, | |
previousVolume: 0.7, | |
isMuted: false, | |
}, | |
states:{ | |
init:{ |
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
/* squoosh-cli2node v0.5.0 | |
use the @squoosh/cli tool in Node via CLI API | |
@2021 Tom Byrer, #licence MIT | |
known bugs: only npm (no yarn pnpm) & bad error reporting | |
*/ | |
const { execSync } = require("child_process") | |
// find squoosh in npm global packages | |
function isFoundInCliResults(command, str){ | |
if (execSync(command).toString().search(str) === -1){ |
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
// volume DRY contrll | |
/* copy/paste below object into bottom of EVENTS tab | |
{ | |
"type": "VOL_CHANGE", | |
"value": 0.9 | |
} | |
*/ | |
function mute(){ | |
console.log('🔇 muted') |
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
// simple mute volume controll | |
function mute(){ | |
console.log('🔇 muted') | |
} | |
function unmute(){ | |
console.log('👂 unmuted') | |
} | |
const volumeMachine = Machine({ |
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
// volume contrll | |
/* | |
{ | |
"type": "VOL_CHANGE", | |
"value": 0.9 | |
} | |
*/ | |
function mute(){ | |
console.log('🔇 muted') |
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
// Master machine for radio buttons | |
const inputGroupMachine = Machine({ | |
id: 'input-group', | |
initial: 'emptied', | |
states: { | |
emptied: { | |
on: { | |
'': { | |
actions: 'loadNew', | |
target: 'pending', |
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
// Master machine for radio buttons | |
const inputGroupMachine = Machine({ | |
id: 'input-group', | |
initial: 'emptied', | |
states: { | |
emptied: { | |
on: { | |
FETCH: 'pending', | |
} | |
}, |
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
// from tomByrer | |
let NAMES = { | |
id: 'enabledPlacer', | |
init: 'first', | |
alt: 'second', | |
third: '3rd', | |
} | |
const smBlender = Machine({ | |
id: [NAMES.id], |
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
// watch console for output | |
// to help visualize Action Order | |
// https://xstate.js.org/docs/guides/actions.html#action-order | |
const watchActions = Machine({ | |
id: 'actionLoop', | |
initial: 'ready', | |
states: { | |
ready: { | |
entry: 'logReadyEntry', | |
on: { |
NewerOlder