Skip to content

Instantly share code, notes, and snippets.

Avatar

Tin Benjamin Matuka tbmatuka

View GitHub Profile
@tbmatuka
tbmatuka / DoubleImage.php
Last active Sep 26, 2021
Blurry lazy loading placeholder SVGs
View DoubleImage.php
<?php
function generatePlaceholderSvg(string $originalImageBinary, string $placeholderImageBinary, ?string $idSuffix = null): string
{
$originalImageSizeInfo = getimagesizefromstring($originalImageBinary);
if (!is_array($originalImageSizeInfo) || !isset($originalImageSizeInfo[3])) {
throw new \RuntimeException('Unable to get image size info.');
}
@tbmatuka
tbmatuka / PlaceholderOutlineFilter.php
Created Sep 26, 2021
LiipImagineBundle placeholder outline filter
View PlaceholderOutlineFilter.php
<?php
namespace App\Service;
use Imagine\Image\Box;
use Imagine\Image\ImageInterface;
use Imagine\Image\Point;
use Liip\ImagineBundle\Imagine\Filter\Loader\LoaderInterface;
class PlaceholderOutlineFilter implements LoaderInterface
View git-switch-user.sh
#!/bin/bash
userName="John Doe"
emails=(
"john@doe.com"
"john.doe@freelance.com"
"john.doe@acme.com"
)
if [[ $1 =~ ^[1-9][0-9]*$ ]]
View base.mjml
<mjml>
<mj-head>
<mj-attributes>
<mj-all font-family="Helvetica"></mj-all>
</mj-attributes>
</mj-head>
<mj-body background-color="#f6f6f6">
<mj-raw>
{% trans_default_domain 'email' %}
<!-- Company Header -->