Skip to content

Instantly share code, notes, and snippets.

View sorenmalling's full-sized avatar

Søren Malling sorenmalling

View GitHub Profile
@sorenmalling
sorenmalling / ModifyDocumentSiteHash.php
Created February 20, 2024 12:24
Setting document sitehash based on the requested site
<?php
namespace Vendor\Solr\EventListener;
use ApacheSolrForTypo3\Solr\Event\Indexing\BeforeDocumentsAreIndexedEvent;
final class ModifyDocumentSiteHash
{
public function __invoke(BeforeDocumentsAreIndexedEvent $event): void
{
@sorenmalling
sorenmalling / Services.yaml
Created October 24, 2023 10:58
TYPO3 TAG ContentObject
services:
_defaults:
autowire: true
autoconfigure: true
public: false
TagContentObject\:
resource: '../Classes/*'
TagContentObject\ContentObject\TagContentObject:
tags:
<?php
$queryResult = new QueryResult();
foreach ($queryResult as $result) {
$data[] = $result;
}
return json_encode($result);
<?php
declare(strict_types=1);
namespace Dafis\Application\Middleware;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Server\MiddlewareInterface;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Server\RequestHandlerInterface;
@sorenmalling
sorenmalling / .platform.app.yaml
Created October 28, 2021 07:06
TYPO3 11 Platform.sh configuration
name: app
type: php:7.4
dependencies:
php:
composer/composer: '^2'
runtime:
extensions:
name: app
type: php:7.4
dependencies:
php:
composer/composer: '^2'
runtime:
extensions:
name: app
type: php:7.4
dependencies:
php:
composer/composer: '^2'
runtime:
extensions:
@sorenmalling
sorenmalling / package.json
Created September 24, 2021 08:38
package.json
{
"name": "application",
"version": "1.0.0",
"scripts": {
"build": "webpack --progress --color --mode production",
"start": "webpack-dev-server --mode development",
"watch": "webpack --progress --color --watch --mode development"
},
"keywords": [],
"author": "",
@sorenmalling
sorenmalling / motionsensor.ino
Created April 29, 2021 09:59
Motion Sensor
int nudgingLedPin = 13; // choose the pin for the LED
int pushButtonPin = 9;
int greenLedPin = 11; // choose the pin for the LED
int inputPin = 2; // choose the input pin (for PIR sensor)
int pirState = LOW; // we start, assuming no motion detected
int val = 0; // variable for reading the pin status
int push = 0;
void setup() {
pinMode(nudgingLedPin, OUTPUT); // declare LED as output
@sorenmalling
sorenmalling / Production.php
Created March 25, 2021 12:37
Example of Surf deployment configuration
<?php
$node = new TYPO3\Surf\Domain\Model\Node('production');
$node
->setHostname('SERVER_IP')
->setOption('username', 'SSH_USERNAME');
$application = new TYPO3\Surf\Application\Neos\Flow('SikkerFaktura Distribution');
$application->setVersion('7.0');
$application
->setOption('keepReleases', 3)