Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Bastian Waidelich bwaidelich

🏠
Working from home
View GitHub Profile
View machine.js
const nestedStates = {
initial: 'a1',
states: {
a1: {
on: {
FOO: "a2"
}
},
a2: {
type: "final"
View machine.js
const machine = Machine(
{
id: "buyBook",
initial: "outside",
context: {
loggedIn: false,
subscription: null,
bookId: null,
initialLocation: null,
alreadySubscribedChosen: false
@bwaidelich
bwaidelich / EelRpcMiddleware.php
Created Apr 9, 2021
Neos Eel evaluator as XML-RPC service (just a crazy demo, don't use this in production!)
View EelRpcMiddleware.php
<?php
declare(strict_types=1);
namespace Some\Package;
use GuzzleHttp\Psr7\Response;
use Neos\Eel\Context;
use Neos\Eel\EelEvaluatorInterface;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Server\MiddlewareInterface;
View machine.js
const todoMachine = Machine({
id: "todo",
initial: "reading",
context: {
completed: false
},
states: {
reading: {
on: {
SET_COMPLETED: {
View machine.js
const playheadMachine = Machine({
id: 'playhead',
initial: 'idle',
context: {
fps: 2,
events: [],
lastEmittedEvent: null,
emitted: [],
playhead: 0
},
View machine.js
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
View machine.js
const machine = Machine({
initial: 'idle',
context: {
userId: null,
projectId: null,
revision: 0
},
type: 'parallel',
states: {
View machine.js
const myMachine = Machine({
id: "machine",
initial: "idle",
context: {
id: null,
revision: 0,
isOwner: false,
isAuthenticated: true
},
states: {
View machine.js
const myMachine = Machine({
id: "machine",
initial: "idle",
context: {
id: null,
revision: 0,
isOwner: false,
isAuthenticated: false
View machine.js
const machine = Machine({
id: 'doctor',
initial: 'idle',
states: {
idle: {
type: 'parallel',
states: {
aok: {
initial: 'idle',
states: {