Skip to content

Instantly share code, notes, and snippets.

@grebaldi
grebaldi / AssetHelper.php
Created May 10, 2021 14:00
`Asset` Eel-Helper that converts asset identifiers to assets
<?php declare(strict_types=1);
namespace Vendor\Site\Application\Helper;
use Neos\Flow\Annotations as Flow;
use Neos\Eel\ProtectedContextAwareInterface;
use Neos\Media\Domain\Model\Asset;
use Neos\Media\Domain\Repository\AssetRepository;
/**
* @Flow\Scope("singleton")
@grebaldi
grebaldi / Root.fusion
Created August 27, 2019 04:55
Find pages with particular nodetypes
root.@process.debug = Neos.Fusion:Component {
nodeType = 'Vendor.Site:ContentType'
items = ${q(site).find('[instanceof ' + this.nodeType + ']').get()}
renderer = Neos.Fusion:Collection {
collection = ${props.items}
itemRenderer = Neos.Fusion:Component {
document = ${q(item).closest('[instanceof Neos.Neos:Document]').get(0)}
title = ${q(this.document).property('title')}
@grebaldi
grebaldi / DefaultValue.fusion
Created October 26, 2018 06:43
Safe way to provide default values for props?
prototype(Vendor.Site:MyComponent) < prototype(Neos.Fusion:Component) {
myProp.@process.default = Vendor.Site:DefaultValue {
value = 'myValue'
}
}
prototype(Vendor.Site:DefaultValue) {
@if.noValueProvided = ${!value}
}
@grebaldi
grebaldi / Spread.fusion
Created September 5, 2018 10:23
Spread in fusion
/**
* In Fusion
*/
foo = Neos.Fusion:Renderer {
type = 'Vendor.Site:Foo'
element {
...${myContextVariable}
...${myOtherContextvariable}
}
}
@grebaldi
grebaldi / keybase.md
Created October 6, 2017 15:53
keybase.md

Keybase proof

I hereby claim:

  • I am grebaldi on github.
  • I am grebaldi (https://keybase.io/grebaldi) on keybase.
  • I have a public key ASDsgGDIgp0zdpmcR66wsC8NpolZCzqrJQPTRtVYUQ6yRwo

To claim this, I am signing this object:

@grebaldi
grebaldi / keymap.cson
Created June 22, 2017 08:55
Enable emmet for fusion
'atom-text-editor[data-grammar="source typoscript2"]:not([mini])':
'tab': 'emmet:expand-abbreviation-with-tab'
@grebaldi
grebaldi / debug-react.js
Created February 20, 2017 15:11
Debug reason for rendering
import debugReasonForRendering from '@neos-project/debug-reason-for-rendering';
import shallowCompare from 'react-addons-shallow-compare';
@debugReasonForRendering
shouldComponentUpdate(...args) {
return shallowCompare(this, ...args);
}
@grebaldi
grebaldi / doctoc.sh
Created December 21, 2016 16:02
doctoc example
doctoc --gitlab --notitle --maxlevel 2 README.md
@grebaldi
grebaldi / Site.xml
Last active March 23, 2018 14:52
minimal Site.xml
<?xml version="1.0" encoding="UTF-8"?>
<root>
<site name="My Site" state="1" siteResourcesPackageKey="Vendor.SitePackage" siteNodeName="my-site">
<nodes formatVersion="2.0">
<node nodeName="my-site">
<variant
workspace="live"
nodeType="Vendor.SitePackage:Document.HomePage"
sortingIndex="100"
version="1"
@grebaldi
grebaldi / build-css.sh
Created August 4, 2016 08:26
Basic sass -> css build stack
#!/usr/bin/env sh
node-sass Resources/Private/Sass/Main.scss | \
postcss --use autoprefixer | \
cleancss > \
Resources/Public/Styles/Main.css