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
@bwaidelich
bwaidelich / CatchUpWorkerCommandController.php
Created November 15, 2023 09:58
Creating a service for the Neos 9.0 Content Repository
<?php
declare(strict_types=1);
final class CatchUpWorkerCommandController extends CommandController {
public function __construct(
private readonly ContentRepositoryRegistry $contentRepositoryRegistry,
private readonly ProjectionCatchUpServiceFactory $projectionCatchUpServiceFactory,
) {
parent::__construct();
@bwaidelich
bwaidelich / Example.fusion
Created June 21, 2022 10:50
Neos CMS: Fusion based Zip Archive (example structure)
<Some.Package:ZipArchiveLink zip.files={['resource://Neos.Neos/Public/Images/Login/Logo.svg', 'resource://Neos.Neos/Public/Images/Login/Wallpaper.jpg']} filename="archive.zip">
Download
</Some.Package:ZipArchiveLink>
@bwaidelich
bwaidelich / Configuration_Policy.yaml
Created November 25, 2021 12:03
Example of a Flow policy that respects method parameters
# Concrete assignments from roles to privileges can happen in your global /Configuration/Policy.yaml file
roles:
'Some.Distribution:Administrator':
privileges:
- privilegeTarget: 'Some.Package:AccessAnyProduct'
permission: GRANT
'Some.Distribution:User':
@bwaidelich
bwaidelich / Tests_Behavior_Bootstrap_FeatureContext.php
Last active April 22, 2022 07:00
GraphQL based Behat testing in Flow
<?php
declare(strict_types=1);
use Behat\Behat\Context\Context;
use Behat\Gherkin\Node\PyStringNode;
use Behat\Gherkin\Node\TableNode;
use Doctrine\DBAL\Connection;
use Doctrine\ORM\EntityManagerInterface;
use Firebase\JWT\JWT;
const nestedStates = {
initial: 'a1',
states: {
a1: {
on: {
FOO: "a2"
}
},
a2: {
type: "final"
const machine = Machine(
{
id: "buyBook",
initial: "outside",
context: {
loggedIn: false,
subscription: null,
bookId: null,
initialLocation: null,
alreadySubscribedChosen: false
@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 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 / 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