Skip to content

Instantly share code, notes, and snippets.

View kdambekalns's full-sized avatar

Karsten Dambekalns kdambekalns

View GitHub Profile
04560bfc6acf43e0a67dfc86bc0a9f69afc8f98fa95e1cb5a6683fbd9865dba36cee7ded1ac4550d336b1c489179071af6f62afeb3d7346ae74b9b82234ea8d971
@kdambekalns
kdambekalns / LanguageVariantFinder.fusion
Created December 21, 2017 11:03
Provide link to "other language" only if it "exists"
prototype(Acme.AcmeCom:LanguageVariantFinder) < prototype(Neos.Fusion:RawArray) {
requestedLanguageCode = ${documentNode.context.targetDimensions.language}
otherLanguageCode = ${this.requestedLanguageCode == 'en' ? 'de' : 'en'}
otherLanguageLabel = ${this.otherLanguageCode == 'en' ? 'Englisch' : 'German'}
otherLanguageText = ${this.otherLanguageCode == 'en' ? 'Diese Seite ist auch verfügbar auf' : 'This page is also available in'}
nodeVariantsExist = ${Array.length(q(documentNode).find('main').find('[instanceof TYPO3.Neos:Content]').context({'dimensions': {'language': [this.otherLanguageCode]}, 'targetDimensions': {'language': this.otherLanguageCode}}).get()) > 0}
otherLanguageNode = ${this.nodeVariantsExist ? q(documentNode).context({'dimensions': {'language': [this.otherLanguageCode, this.requestedLanguageCode]}, 'targetDimensions': {'language': this.otherLanguageCode}}).get(0) : null}
@kdambekalns
kdambekalns / README.md
Last active October 9, 2015 09:54
Open questions on OData v4

This document collects some odd bits and pieces on OData v4.

Content negotiation

The $metadata document

The OData specification says:

If a request for metadata does not specify a format preference (via Accept header or $format) then the XML representation MUST be returned.

@kdambekalns
kdambekalns / README.md
Last active September 24, 2015 15:12
How to update an existing PR to the new PSR-2 standard
@kdambekalns
kdambekalns / composer.json
Created August 19, 2015 15:02
Minimum composer.json for a Neos 2.0.* project
{
"name": "amce/site-distribution",
"description" : "Acme Neos Distribution",
"license": "proprietary",
"config": {
"vendor-dir": "Packages/Libraries",
"bin-dir": "bin"
},
"require": {
"typo3/neos": "^2.0.0",
@kdambekalns
kdambekalns / gist:186f2c5237ab1bfd7c8e
Last active August 29, 2015 14:22
Solving issues with Neos 1.x or Flow 2.x and doctrine/migrations

Flow has always used doctrine/migrations as dev-master. Now a 1.0 release of the migrations package is approaching and some breaking changes spoil the fun. See these issues for some details:

The typo3/flow package has been updated and new 2.x releases have been tagged. But you need to make sure your root manifest (composer.json) is requiring the correct version of doctrine/migrations as well. It should be pinned to the last version that is known not to conflict with the other dependencies of Flow.

Below is what you must require instead of anything else (like @dev or dev-master).

@kdambekalns
kdambekalns / README.md
Last active August 29, 2015 14:20
Using injected properties of Flow functional test in @dataProvider

PHPUnit collects the data from a dataProvider early during test execution, so the PersistenceManager instance is NULL, if used directly in the provider. Returning a closure that is re-bound during the the test makes this work.

@kdambekalns
kdambekalns / patchset-created
Last active August 20, 2020 05:15
Gerrit commit message check hook
#!/bin/bash
BASE="/home/gerrit/review/git"
while [ "$1" != "" ]; do
case $1 in
--change) CHANGE=$2; shift;;
--project) PROJECT=$2; shift;;
--branch) BRANCH=$2; shift;;
--uploader) UPLOADER=$2; shift;;
### Keybase proof
I hereby claim:
* I am kdambekalns on github.
* I am kdambekalns (https://keybase.io/kdambekalns) on keybase.
* I have a public key whose fingerprint is 83A6 72CA 9991 5A05 3D28 D18E 0DB1 E2DA 4FF4 AFAE
To claim this, I am signing this object:
@kdambekalns
kdambekalns / README.rst
Created February 12, 2014 11:51
Fetch changes from Gerrit automatically (from review.typo3.org)

How to use

This script reads changes from the file gerrit.json. The description is just for the humans working with the file, the important bits are the project name and the numeric change id. If the change id is amended with a command and number that means "fetch that specific patch set" instread of the latest one.

If you have gerrit.json ready just run php gerrit_update.php and watch the magic. :)