Skip to content

Instantly share code, notes, and snippets.

View bwaidelich's full-sized avatar
🏠
Working from home

Bastian Waidelich bwaidelich

🏠
Working from home
View GitHub Profile
const machine = Machine(
{
id: "buyBook",
initial: "outside",
context: {
loggedIn: false,
subscription: null,
bookId: null,
initialLocation: null,
alreadySubscribedChosen: false
@bwaidelich
bwaidelich / machine.js
Last active April 10, 2021 09:16
Generated by XState Viz: https://xstate.js.org/viz
const playheadMachine = Machine({
id: 'playhead',
initial: 'idle',
context: {
fps: 2,
events: [],
lastEmittedEvent: null,
emitted: [],
playhead: 0
},
@bwaidelich
bwaidelich / EelRpcMiddleware.php
Created April 9, 2021 14:40
Neos Eel evaluator as XML-RPC service (just a crazy demo, don't use this in production!)
<?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;
const todoMachine = Machine({
id: "todo",
initial: "reading",
context: {
completed: false
},
states: {
reading: {
on: {
SET_COMPLETED: {
@bwaidelich
bwaidelich / machine.js
Last active April 5, 2021 14:40
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@bwaidelich
bwaidelich / machine.js
Created March 21, 2021 14:57
Generated by XState Viz: https://xstate.js.org/viz
const machine = Machine({
initial: 'idle',
context: {
userId: null,
projectId: null,
revision: 0
},
type: 'parallel',
states: {
@bwaidelich
bwaidelich / machine.js
Created March 19, 2021 18:47
Generated by XState Viz: https://xstate.js.org/viz
const myMachine = Machine({
id: "machine",
initial: "idle",
context: {
id: null,
revision: 0,
isOwner: false,
isAuthenticated: true
},
states: {
@bwaidelich
bwaidelich / machine.js
Last active March 13, 2021 20:09
Generated by XState Viz: https://xstate.js.org/viz
const myMachine = Machine({
id: "machine",
initial: "idle",
context: {
id: null,
revision: 0,
isOwner: false,
isAuthenticated: false
@bwaidelich
bwaidelich / machine.js
Last active February 17, 2021 13:52
Generated by XState Viz: https://xstate.js.org/viz
const machine = Machine({
id: 'doctor',
initial: 'idle',
states: {
idle: {
type: 'parallel',
states: {
aok: {
initial: 'idle',
states: {
@bwaidelich
bwaidelich / GraphQlMiddleware.php
Created January 18, 2021 09:01
Minimal GraphQL example for Flow for interface types
<?php
declare(strict_types=1);
namespace Some\App;
use GraphQL\Error\DebugFlag;
use GraphQL\GraphQL;
use GraphQL\Utils\BuildSchema;
use GuzzleHttp\Psr7\Response;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;