Skip to content

Instantly share code, notes, and snippets.

View pekeler's full-sized avatar
🏓

Christian Pekeler pekeler

🏓
View GitHub Profile
@pekeler
pekeler / index.js
Created September 6, 2016 20:59
requirebin sketch
function setTimeout(f, delay) {
f()
}
const choo = require('choo')
const html = require('choo/html')
const app = choo()
app.model({
state: {
@pekeler
pekeler / index.js
Created September 7, 2016 17:11
requirebin sketch
const choo = require('choo')
const html = require('choo/html')
const app = choo()
app.model({
state: {
title: 'existing text',
isValid: true
},
reducers: {
@pekeler
pekeler / index.js
Last active September 7, 2016 22:35
requirebin sketch
const choo = require('choo')
const html = require('choo/html')
const app = choo()
app.model({
state: {
title: 'existing text',
isValid: true,
isEditing: false
},
@pekeler
pekeler / r2d2.js
Created October 12, 2025 15:58
Converts a Robot state machine to D2 diagram syntax
/**
* Converts a Robot state machine to D2 diagram syntax
*
* Generates a statechart-style visualization with:
* - States, transitions (with event labels), and immediate transitions
* - Guard conditions indicated with [...] notation (e.g., '[...] event')
* - Current state highlighting, final state indicators, invoke state coloring
* - Support for nested machines with recursive rendering
*
* @param {object} machine - A Robot state machine created with createMachine()