Skip to content

Instantly share code, notes, and snippets.

View tomByrer's full-sized avatar
🎦
researching video players

Tom Byrer tomByrer

🎦
researching video players
View GitHub Profile
@tomByrer
tomByrer / index.mjs
Created September 15, 2021 15:47
faker.js addresses
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(),
@tomByrer
tomByrer / machine.js
Last active May 22, 2021 03:09
Generated by XState Viz: https://xstate.js.org/viz
const volumeMachine = Machine({
id: 'volume',
initial: 'init',
context: {
volume: 0.7,
previousVolume: 0.7,
isMuted: false,
},
states:{
init:{
/* 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){
@tomByrer
tomByrer / machine.js
Last active February 8, 2021 05:00
Generated by XState Viz: https://xstate.js.org/viz
// volume DRY contrll
/* copy/paste below object into bottom of EVENTS tab
{
"type": "VOL_CHANGE",
"value": 0.9
}
*/
function mute(){
console.log('🔇 muted')
@tomByrer
tomByrer / machine.js
Last active February 8, 2021 04:49
Generated by XState Viz: https://xstate.js.org/viz
// simple mute volume controll
function mute(){
console.log('🔇 muted')
}
function unmute(){
console.log('👂 unmuted')
}
const volumeMachine = Machine({
@tomByrer
tomByrer / machine.js
Last active February 8, 2021 04:40
Generated by XState Viz: https://xstate.js.org/viz
// volume contrll
/*
{
"type": "VOL_CHANGE",
"value": 0.9
}
*/
function mute(){
console.log('🔇 muted')
@tomByrer
tomByrer / machine.js
Last active January 16, 2021 21:50
Generated by XState Viz: https://xstate.js.org/viz
// Master machine for radio buttons
const inputGroupMachine = Machine({
id: 'input-group',
initial: 'emptied',
states: {
emptied: {
on: {
'': {
actions: 'loadNew',
target: 'pending',
@tomByrer
tomByrer / machine.js
Created January 16, 2021 19:29
Generated by XState Viz: https://xstate.js.org/viz
// Master machine for radio buttons
const inputGroupMachine = Machine({
id: 'input-group',
initial: 'emptied',
states: {
emptied: {
on: {
FETCH: 'pending',
}
},
@tomByrer
tomByrer / machine.js
Last active December 15, 2020 03:00
Generated by XState Viz: https://xstate.js.org/viz
// from tomByrer
let NAMES = {
id: 'enabledPlacer',
init: 'first',
alt: 'second',
third: '3rd',
}
const smBlender = Machine({
id: [NAMES.id],
@tomByrer
tomByrer / machine.js
Last active November 17, 2020 22:39
Generated by XState Viz: https://xstate.js.org/viz
// 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: {