Skip to content

Instantly share code, notes, and snippets.

View alexander-schranz's full-sized avatar

Alexander Schranz alexander-schranz

View GitHub Profile
@nicholasc
nicholasc / Duotone.php
Last active January 4, 2022 07:05
A Duotone filter for Imagine PHP library.
<?php
use Imagine\Image\Point;
use Imagine\Image\ImageInterface;
use Imagine\Filter\FilterInterface;
use Imagine\Filter\Advanced\OnPixelBased;
use Imagine\Image\Palette\Color\RGB;
/**
* Duotone
@wachterjohannes
wachterjohannes / CourseSubscriber.php
Created September 18, 2017 06:41
Create article from website-kernel
<?php
namespace App\Course;
use PHPCR\NodeInterface;
use PHPCR\SessionInterface;
use PHPCR\Util\UUIDHelper;
use Sulu\Bundle\ArticleBundle\Document\Behavior\DateShardingBehavior;
use Sulu\Component\DocumentManager\Event\FlushEvent;
use Sulu\Component\DocumentManager\Event\PersistEvent;
@fbouchery
fbouchery / extract.php
Last active March 14, 2024 09:49
Extract phpstan baseline history count from GIT
<?php
$baselineFile = 'phpstan-baseline.neon';
$branch = 'origin/main';
echo "date;count\n";
foreach (explode("\n", `git log {$branch} --pretty="format:%H;%cI" --date-order --reverse {$baselineFile}`) as $line) {
[$hash, $date] = explode(';', $line);
preg_match_all('`^\s+count:\s+(\d+)`m', `git show $hash:{$baselineFile}`, $matches);
echo $date, ';', array_sum(array_map('intval', $matches[1])), "\n";
}