Skip to content

Instantly share code, notes, and snippets.

View tbmatuka's full-sized avatar

Tin Benjamin Matuka tbmatuka

View GitHub Profile
@tbmatuka
tbmatuka / DoubleImage.php
Last active September 26, 2021 19:25
Blurry lazy loading placeholder SVGs
<?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 September 26, 2021 18:57
LiipImagineBundle placeholder outline filter
<?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
#!/bin/bash
userName="John Doe"
emails=(
"john@doe.com"
"john.doe@freelance.com"
"john.doe@acme.com"
)
if [[ $1 =~ ^[1-9][0-9]*$ ]]
<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 -->