Skip to content

Instantly share code, notes, and snippets.

View hadl's full-sized avatar

Andreas Bibow hadl

View GitHub Profile
@hadl
hadl / Gotenberg 8 pre-installed fonts and styles
Last active February 26, 2026 17:00
Gotenberg 8 pre-installed fonts and styles
> fc-list : family style | awk -F':style=' '{print $1 ":style=" $2}' | awk -F',' '{print $1}' | sort | uniq
AR PL UKai CN:style=Book
AR PL UKai HK:style=Book
AR PL UKai TW MBE:style=Book
AR PL UKai TW:style=Book
AR PL UMing CN:style=Light
AR PL UMing HK:style=Light
AR PL UMing TW MBE:style=Light
AR PL UMing TW:style=Light
@hadl
hadl / RemoveCommentFromConstructorPromotionRector.php
Created February 10, 2025 09:12
Rector rule to remove comments in constructor arguments when using ClassPropertyAssignToConstructorPromotionRector
<?php
declare(strict_types=1);
namespace Utils\Rector\Rector;
use PhpParser\Node;
use PhpParser\Node\Param;
use PhpParser\Node\Stmt\ClassMethod;
use Rector\Rector\AbstractRector;
@hadl
hadl / alter-twig.php
Last active May 27, 2021 13:47
patternlab node - engine-twig-php extend/alter twig
<?php
/**
* @param Twig_Environment $env - The Twig Environment - https://twig.symfony.com/api/1.x/Twig_Environment.html
* @param $config - Config of `@basalt/twig-renderer`
*/
function addCustomExtension(\Twig_Environment &$env, $config) {
$env->addExtension(new \Twig_Extension_Debug());
/**
@hadl
hadl / slider-prev-next-buttons.js
Created July 1, 2020 08:23
Flickity next/prev buttons disable on "last page" when using contain
import Flickity from 'flickity';
(() => {
const { PrevNextButton } = Flickity;
const parentUpdate = PrevNextButton.prototype.update;
PrevNextButton.prototype.update = function update() {
parentUpdate.call(this);
if (this.parent.slideableWidth < this.parent.size.innerWidth) {
@hadl
hadl / slider-lazysizes.js
Last active July 1, 2020 08:20
Flickity & Lazysizes
/* eslint-disable no-underscore-dangle,prefer-rest-params */
import Flickity from 'flickity';
(() => {
const oldFlickityCreate = Flickity.prototype._create;
Flickity.prototype._create = function create() {
const that = this;
if (this.element.addEventListener) {
<?php
/**
* Color Input Editable
*/
namespace AppBundle\Model\Document\Tag;
use Pimcore\Model\Document\Tag\Input;
class Color extends Input
@hadl
hadl / TranslateUpdateTrait.php
Last active April 9, 2019 09:18
[Pimcore 5 Migration] TranslateUpdateTrait
<?php
/**
* TranslateUpdateTrait
*/
use Doctrine\DBAL\Schema\Schema;
/**
* Class TranslateUpdateTrait
*
@hadl
hadl / LanguageSwitcherExtension.php
Last active January 15, 2019 11:14
Pimcore 5 Basic Language Switcher with Twig Extension
/**
* Provides get_localized_links function in the Twig.
*
* Class LanguageSwitcherExtension
*/
class LanguageSwitcherExtension extends \Twig_Extension
{
/**
* Pimcore documents service which provide needed methods.
*
@hadl
hadl / gist:892a6ea257fa0c37fd517b150b8fb8dd
Created August 2, 2018 14:07
Split mp3 into x seconds parts with ffmpeg
ffmpeg -i file.mp3 -f segment -segment_time 7200 -c copy out%03d.mp3
# -segment_time in seconds
@hadl
hadl / gist:0c35bce6d3de698c92efca5873a557ee
Created April 27, 2016 09:42
Imagemagick convert pngs to progressive jpgs
mogrify -strip -interlace Plane -format jpg -colorspace sRGB -quality 85 *.png