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 / 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
@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 / DeletedFilter.php
Last active August 9, 2019 23:41 — forked from baptistedonaux/DeletedFilter.php
Soft Delete Symfony/Doctrine
<?php
namespace Namespace\MyBundle\Repository\Filters;
use Doctrine\ORM\Mapping\ClassMetaData;
use Doctrine\ORM\Query\Filter\SQLFilter;
class DeletedFilter extends SQLFilter
{
public function addFilterConstraint(ClassMetadata $targetEntity, $targetTableAlias)
{
@a-r-m-i-n
a-r-m-i-n / Easy Admin Bundle ConfigPass.md
Last active May 27, 2020 13:11
This document describes the process of Symfony's Easy Admin Bundle, to process the given YAML configuration, with registered **ConfigPass** classes.

Easy Admin Bundle ConfigPass

This document describes the process of Symfony's Easy Admin Bundle, to process the given YAML configuration, with registered ConfigPass classes.

The problem

Those ConfigPasses are collections of private methods, which have e.g. action names hardcoded, so you can't reuse the "config auto-magic" for your new actions.

@a-r-m-i-n
a-r-m-i-n / GlossaryController.php
Created February 27, 2019 07:28
TYPO3 Fluid Widget to achieve a Glossary navigation.
<?php
namespace Vendor\Package\ViewHelpers\Widget\Controller;
/**
* This view helper uses the technology of paginate widget but works with arrays
* and the assigned objects don't need the QueryResultInterface.
*
* @author Armin Vieweg <armin@v.ieweg.de>
* @license http://www.gnu.org/licenses/gpl.html GNU General Public License, version 3 or later
*/
@a-r-m-i-n
a-r-m-i-n / TYPO3 Extension Box.md
Last active September 2, 2019 10:47
Generic Vagrantfile for TYPO3 extension development

TYPO3 Extension Box

Version: 1.2.0

URL: bit.ly/typo3-extension-box

This Vagrantfile ships a handy development environment for TYPO3 extensions. The shell based provision scripts, use Composer to fetch TYPO3 CMS and all required dependencies - for different TYPO3 versions:

  • TYPO3 CMS 8.7 LTS