Skip to content

Instantly share code, notes, and snippets.

View kdambekalns's full-sized avatar

Karsten Dambekalns kdambekalns

View GitHub Profile
@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;;
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}
### 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:
<?php
namespace TYPO3\Fluid\ViewHelpers\Format;
/* *
* This script belongs to the TYPO3 Flow package "Fluid". *
* *
* It is free software; you can redistribute it and/or modify it under *
* the terms of the GNU Lesser General Public License, either version 3 *
* of the License, or (at your option) any later version. *
* *
@kdambekalns
kdambekalns / gist:5239005
Created March 25, 2013 17:41
Example for a possible syntax of validation rules in YAML files
validation:
-
type: 'NotEmpty'
-
type: 'RegularExpression'
options:
regularExpression: '(0?[1-9]|[12][0-9]|3[01])'
@kdambekalns
kdambekalns / gist:5111134
Created March 7, 2013 19:43
SQL to update the table used for storing Role instances (with https://review.typo3.org/13868) - this is needed when switching to patch set 23 or higher.
ALTER TABLE typo3_flow_security_policy_role ADD new_sourcehint VARCHAR(6) NOT NULL;
UPDATE typo3_flow_security_policy_role SET new_sourcehint='system' where sourcehint=0;
UPDATE typo3_flow_security_policy_role SET new_sourcehint='policy' where sourcehint=1;
UPDATE typo3_flow_security_policy_role SET new_sourcehint='user' where sourcehint=2;
ALTER TABLE typo3_flow_security_policy_role DROP sourcehint;
ALTER TABLE typo3_flow_security_policy_role CHANGE new_sourcehint sourcehint VARCHAR(6) NOT NULL;
@kdambekalns
kdambekalns / FrontendUser.php
Created February 14, 2013 10:07
Example for mapping the TYPO3 CMS fe_users table to a TYPO3 Flow domain model
<?php
namespace Acme\Demo\Domain\Model;
/* *
* This script belongs to the TYPO3 Flow package "Acme.Demo". *
* *
* */
use TYPO3\Flow\Annotations as Flow;
use Doctrine\ORM\Mapping as ORM;
@kdambekalns
kdambekalns / DefaultViewHelper.php
Created February 14, 2013 08:48
A Fluid ViewHelper to fall back to a default value in case a variable is empty.
<?php
namespace Api\Core\ViewHelpers;
/* *
* This script belongs to the TYPO3 Flow package "Api.Core". *
* *
* */
use TYPO3\Flow\Annotations as Flow;
@kdambekalns
kdambekalns / composer.json
Created September 25, 2012 18:57 — forked from christianjul/composer.json
FLOW3 Barebone manifest
{
"name": "christianjul/barebone-flow3",
"description" : "Barebone FLOW3 project",
"license": "LGPL-3.0+",
"authors": [
{
"name": "Christian Jul Jensen",
"email": "julle@typo3.org"
}
],