Skip to content

Instantly share code, notes, and snippets.

Working from home

Bastian Waidelich bwaidelich

Working from home
Block or report user

Report or block bwaidelich

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
bwaidelich / ServerSentComponent.php
Created Nov 14, 2019
Example: Flow HTTP Component for Server-Sent Events
View ServerSentComponent.php
namespace Some\Package\Http;
use Neos\Flow\Http\Component\ComponentContext;
use Neos\Flow\Http\Component\ComponentInterface;
use Neos\Flow\Http\Helper\MediaTypeHelper;
final class ServerSentComponent implements ComponentInterface
bwaidelich / CacheFlusher.php
Last active Sep 2, 2019
Neos CMS: Get (relative) Node Url upon publishing
View CacheFlusher.php
namespace Some\Package;
use Neos\ContentRepository\Domain\Model\NodeInterface;
use Neos\ContentRepository\Domain\Model\Workspace;
use Neos\Eel\FlowQuery\FlowQuery;
use Neos\Flow\Annotations as Flow;
use Neos\Flow\Http\HttpRequestHandlerInterface;
use Neos\Flow\Mvc\ActionRequest;
use Neos\Flow\Mvc\Routing\UriBuilder;
bwaidelich / JsonCapableExceptionView.php
Created Jun 19, 2019
Render Neos / Flow exceptions as JSON if a corresponding Accept / Content-Type header is set
View JsonCapableExceptionView.php
namespace Some\Package\Error;
use Neos\Flow\Annotations as Flow;
use Neos\Flow\Http\Helper\ResponseInformationHelper;
use Neos\Flow\Http\Request;
use Neos\Flow\Mvc\Controller\ControllerContext;
use Neos\Flow\Mvc\View\ViewInterface;
use Neos\Utility\MediaTypes;
bwaidelich / SiteRequestPattern.php
Last active Jun 6, 2019
Neos Flow Authentication Provider Request Pattern matching Neos Sites by their node name
View SiteRequestPattern.php
namespace Some\Package;
use Neos\Flow\Annotations as Flow;
use Neos\Flow\Mvc\ActionRequest;
use Neos\Flow\Mvc\RequestInterface;
use Neos\Flow\Security\Context;
use Neos\Flow\Security\Exception as SecurityException;
use Neos\Flow\Security\Exception\InvalidRequestPatternException;
View AuthenticationContext.php
namespace Some\Package\Security;
use Neos\Cache\CacheAwareInterface;
use Neos\Flow\Annotations as Flow;
* @Flow\Scope("singleton")
bwaidelich / main.go
Last active Jan 31, 2019
Golang Value Object tests
View main.go
package main
import (
// EmailAddress Value Object
type EmailAddress string
bwaidelich / Root.fusion
Created Jan 15, 2019
Atomic Fusion: Content with TOC
View Root.fusion
prototype(Some.Package:Component.ContentWithToc) < prototype(Neos.Fusion:Component) {
blocks = Neos.Fusion:RawArray
renderer = afx`
<Neos.Fusion:Collection collection={props.blocks} itemName="block" @children="itemRenderer">
<a href={'#c-' + iterator.cycle}>{block.label}</a>
bwaidelich / MainMenuItems.fusion
Created Jan 4, 2019
Fusion based Menu implementation for Neos CMS
View MainMenuItems.fusion
prototype(Some.Package:MainMenuItems) < prototype(Neos.Fusion:Component) {
renderer = Neos.Fusion:RawCollection {
collection = ${q(site).children('[instanceof Neos.Neos:Document]').get()}
@context.rootline = ${q(documentNode).parents('[instanceof Neos.Neos:Document]').get()}
itemName = 'node'
itemRenderer = Some.Package:Component.Organism.Menu.Item {
title = ${q(node).property('title')}
href = Neos.Neos:NodeUri {
node = ${node}
bwaidelich / Component_Atom_DefaultElement.fusion
Last active Jul 17, 2019
Atomic Fusion based Form Definition
View Component_Atom_DefaultElement.fusion
prototype(My.Package:Form.DefaultElement) < prototype(Neos.Fusion:Component) {
id = ''
name = ''
label = ''
value = null
isRequired = false
properties = Neos.Fusion:RawArray
validationErrors = Neos.Fusion:RawArray
bwaidelich / rollyourown.php
Created Jun 7, 2018 — forked from mathiasverraes/rollyourown.php
We don't need no DIC libs / we don't need no deps control
View rollyourown.php
// Context: I'm trying to argue that DI (and DIC) are great, and DIC libs suck.
// Happy to be proven wrong!
final class Router {
private $dependencies;
public function __construct (Dependencies $dependencies) {
$this->dependencies = $dependencies;
// You might say that this is Service Locator, but it's not. This router is toplevel,
// and toplevel must have access to dependencies. After that it can all just bubble nicely using proper DI.
You can’t perform that action at this time.