Skip to content

Instantly share code, notes, and snippets.

View garvinhicking's full-sized avatar

Garvin Hicking garvinhicking

View GitHub Profile
####################
# SCHOKOMUFFINS
# SAFTIG UND LUFTIG
#####################
Zutaten:
========
Ergibt ca. 20 Muffins.
@garvinhicking
garvinhicking / generate.sh
Created November 26, 2024 11:01
PHPStan 2 -> TYPO3 v14 main
#/bin/bash
# Moves away baseline, outputs all errors to "phpstan.json", move back baseline
t3-stan='mv Build/phpstan/phpstan-baseline.neon Build/phpstan/phpstan-baseline.neon.bak && touch Build/phpstan/phpstan-baseline.neon \
&& ./bin/phpstan analyse -c Build/phpstan/phpstan.local.neon --error-format=json --verbose --memory-limit 4G > phpstan.json \
&& mv Build/phpstan/phpstan-baseline.neon.bak Build/phpstan/phpstan-baseline.neon'
------ ----------------------------------------------------------------------------------------------------
Line adminpanel/Classes/Modules/PreviewModule.php
------ ----------------------------------------------------------------------------------------------------
276 Strict comparison using !== between Psr\Log\LoggerInterface and null will always evaluate to true.
🪪 notIdentical.alwaysTrue
------ ----------------------------------------------------------------------------------------------------
------ ----------------------------------------------------------------------------------------------------------------------------------------------------------------
Line backend/Classes/Backend/Avatar/Avatar.php
------ ----------------------------------------------------------------------------------------------------------------------------------------------------------------
@garvinhicking
garvinhicking / parse-json.php
Created July 1, 2024 14:57
Pleroma rejection filter
<?php
$stdin = file_get_contents('php://stdin');
$json = json_decode($stdin, true, JSON_OBJECT_AS_ARRAY | JSON_THROW_ON_ERROR);
if ($json['group'] !== ':pleroma' || $json['key'] !== ':mrf_simple') {
echo "Only :pleroma & :mrf_simple JSON supported. Stop feeding me microplastics.\n";
exit(1);
}
$count = 0;
echo '"Site";"Reason"' . "\n";
foreach ($json['value'] as $json_struct) {
@garvinhicking
garvinhicking / patch.diff
Created January 24, 2024 20:33
TYPO3 ImportExport stripPathSitePrefix Patch
diff --git a/typo3/sysext/impexp/Classes/Export.php b/typo3/sysext/impexp/Classes/Export.php
index 54b4b63599..dd94d85749 100644
--- a/typo3/sysext/impexp/Classes/Export.php
+++ b/typo3/sysext/impexp/Classes/Export.php
@@ -1095,7 +1095,7 @@ class Export extends ImportExport
$fileInfo = [];
$fileInfo['filename'] = PathUtility::basename($fileData['ID_absFile']);
$fileInfo['filemtime'] = $fileStat['mtime'];
- $fileInfo['relFileRef'] = PathUtility::stripPathSitePrefix($fileData['ID_absFile']);
+ $fileInfo['relFileRef'] = PathUtility::stripPathSitePrefix((string)$fileData['ID_absFile'] ?? '');
bacon/bacon-qr-code 2.0.8 BaconQrCode is a QR code generator for PHP.
bnf/phpstan-psr-container 1.0.1 PHPStan dynamic return type extension for PSR-11 ContainerInterface
christian-riesen/base32 1.6.0 Base32 encoder/decoder according to RFC 4648
composer/pcre 3.1.1 PCRE wrapping library that offers type-safe preg_* replacements.
composer/semver 3.4.0 Semver library that offers utilities, version constraint parsing and validation.
composer/xdebug-handler 3.0.3 Restarts a process without Xdebug.
contentblocks/examples dev-main 7d19858 TYPO3 CMS Content Blocks examples
dasprid/enum 1.0.5 PHP 7.1 enum implementation
doctrine/annotations 2.0.1 Docblock Annotations Parser
doctrine/cache 2.2.0 PHP Doctrine Cache library is a popular cache implementation that supports m
@garvinhicking
garvinhicking / index.html
Created November 30, 2023 11:47
SVG crop dummy implementation
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>SVG comparison</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<style>
* {
box-sizing: border-box;
font-family: sans-serif;
@garvinhicking
garvinhicking / Makefile
Created November 9, 2023 17:17
Makefile
PHP_BIN ?= docker run -it --rm --user $$(id -u):$$(id -g) -v${PWD}:/opt/project -w /opt/project php:8.2-cli php -d memory_limit=1024M
PHP_PROJECT_BIN = docker run -i --rm --user $$(id -u):$$(id -g) -v${PWD}:/project typo3-docs:local php -d memory_limit=1024M
## This can be adapted in the .git/hooks/pre-commit call of this step. If you change this line (i.e. new PHP version), also change it in that template
.PHONY: help
help: ## Displays this list of targets with descriptions
@grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[32m%-30s\033[0m %s\n", $$1, $$2}'
.PHONY: code-style
code-style:
@garvinhicking
garvinhicking / SpiderApplication.php
Created November 9, 2023 10:09
SpiderApplication - `php cli.php`
<?php
namespace TYPO3\CMS\Core\Console;
use Symfony\Component\Console\Application as SymfonyConsoleApplication;
use Symfony\Component\Console\Exception\ExceptionInterface;
use Symfony\Component\Console\Input\ArgvInput;
use Symfony\Component\Console\Output\ConsoleOutput;
use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
use TYPO3\CMS\Core\Adapter\EventDispatcherAdapter as SymfonyEventDispatcher;
@garvinhicking
garvinhicking / recoverypatch-11.5.diff
Created October 26, 2023 19:27
Recovery me, oh danny boy
diff --git a/typo3/sysext/felogin/Classes/Service/RecoveryService.php b/typo3/sysext/felogin/Classes/Service/RecoveryService.php
index a460d3d899..2b19652e2c 100644
--- a/typo3/sysext/felogin/Classes/Service/RecoveryService.php
+++ b/typo3/sysext/felogin/Classes/Service/RecoveryService.php
@@ -138,7 +138,9 @@ class RecoveryService implements RecoveryServiceInterface
*/
protected function prepareMail(Address $receiver, string $hash): Email
{
- $url = $this->uriBuilder->setCreateAbsoluteUri(true)
+ $url = $this->uriBuilder