Skip to content

Instantly share code, notes, and snippets.

View a-r-m-i-n's full-sized avatar

Armin Vieweg a-r-m-i-n

View GitHub Profile
@a-r-m-i-n
a-r-m-i-n / README.md
Created April 30, 2026 15:28
Run PHP in WSL via Docker

Run PHP in WSL via Docker

This Gist provides a small wrapper script to run PHP inside Docker from WSL, without installing PHP locally.

Requirements

  • WSL installed
  • Docker Desktop installed and enabled for your WSL distro
  • Bash
@a-r-m-i-n
a-r-m-i-n / EditRecordAsDefaultActionInLiveSearchEventListener.php
Created January 28, 2026 15:46
Set the "edit_record" action in TYPO3's LiveSearch in Backend to default action
<?php
namespace Vendor\Project\EventListeners;
use TYPO3\CMS\Backend\Search\Event\ModifyResultItemInLiveSearchEvent;
use TYPO3\CMS\Backend\Search\LiveSearch\ResultItemAction;
use TYPO3\CMS\Core\Attribute\AsEventListener;
#[AsEventListener(identifier: 'ext-project/edit-record-as-default-in-live-search-event-listener')]
class EditRecordAsDefaultActionInLiveSearchEventListener
@a-r-m-i-n
a-r-m-i-n / array2ts.php
Last active July 22, 2023 17:52
Method to convert array to TypoScript string
<?php
/**
* Converts given array to TypoScript
*
* @param array $typoScriptArray The array to convert to string
* @param string $addKey Prefix given values with given key (eg. lib.whatever = {...})
* @param integer $tab Internal
* @param boolean $init Internal
* @return string TypoScript
@a-r-m-i-n
a-r-m-i-n / FaViewHelper.php
Created March 25, 2020 14:41
Font Awesome ViewHelper (using SVG sprites) for TYPO3 CMS 9+
<?php declare(strict_types=1);
namespace Armin\Vieweg\ViewHelpers;
use TYPO3\CMS\Core\Core\Environment;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
/**
* Font Awesome SVG ViewHelper
@a-r-m-i-n
a-r-m-i-n / constants.ts
Created June 23, 2015 15:14
TypoScript for creating a language dropdown menu (with select and option tags)
global {
languageLabels {
current = Deutsch
availableSysLanguageUids = 0,1
additionalParams = &L=0 || &L=1
availableLabels = Deutsch || English
}
}
@a-r-m-i-n
a-r-m-i-n / testomat5000.php
Created January 11, 2023 10:29
Super simple PHP benchmark script
<?php
// Adjust database credentials in lines 37-40
// And just run on CLI
// On very fast devices the amount of time for each test, should be less than 1 second
$start = microtime(true);
for ($i = 0; $i < 100000000; $i++) {
sqrt($i);
@a-r-m-i-n
a-r-m-i-n / symfony-cli-command-without-console
Last active June 9, 2021 17:32
Using Symfony on CLI without a Console application
#!/usr/bin/env php
<?php
use App\Entity\User;
use App\Kernel;
use Doctrine\Bundle\DoctrineBundle\Registry;
if (!is_file(dirname(__DIR__).'/vendor/autoload_runtime.php')) {
throw new LogicException('Symfony Runtime is missing. Try running "composer require symfony/runtime".');
}
@a-r-m-i-n
a-r-m-i-n / fbled.css
Created May 31, 2021 10:06
Ein kombiniertes, herunterladbares Gist mit HTML/JS, um die LEDs einer alten FritzBox komplett zu deaktivieren. Gefunden in diesem Blog-Post: https://www.ifun.de/fritzbox-leds-komplett-ausschalten-einfaches-script-deaktiviert-router-leuchten-102913/
header {
width:100%;
position:relative;
top:0;
left:0;
background-color:#006ec0;
color:white;
font-size:50px;
text-align:center;
font-family:Arial;
@a-r-m-i-n
a-r-m-i-n / CreateInstanceTrait.php
Created March 29, 2021 19:46
CreateInstanceTrait for TYPO3 CMS
<?php
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Utility\StringUtility;
use TYPO3\CMS\Extbase\Object\ObjectManager;
trait CreateInstanceTrait
{
/** @return parent */
public static function createInstance()
@a-r-m-i-n
a-r-m-i-n / README.md
Last active August 29, 2020 19:56
Example composer.json and DDEV config.yaml for a TYPO3 CMS extension, running in a local environment
$ ddev start
$ ddev composer install
$ ddev composer run typo3