Skip to content

Instantly share code, notes, and snippets.

@adamkiss
adamkiss / index.php
Last active April 19, 2025 08:41
Kirby: easy Simple Snippets plugin
<?php
use Kirby\Cms\App;
App::plugin('adamkiss/simple-snippets', []);
if (! function_exists('s')) {
/**
* Short, auto-return snippet call with support for auto-merging certain parameters
*
* @param string $snippetName

Kirby 3 CLI

Add the function below to your ~/.bashrc or ~/.zshrc file.

Usage:

  • kirby <branch>
  • kirby
@jennyknuth
jennyknuth / README.md
Last active March 5, 2025 18:51
Transform an SVG into a data URI—best practice

How to transform an SVG into a data URI

by Jenny Knuth, based on the work of Chris Coyier and Taylor Hunt

A data URI is a nice way to include a web resource without needing to make an HTTP request. Chris Coyier explains the technique nicely in Probably Don't Base64 SVG.

While a PNG might use Base64 encoding, for SVG, there is a better way.

Taylor Hunt's experiments led to this solution for optimizing SVGs in data URIs:

"So the best way of encoding SVG in a data URI is data:image/svg+xml,[actual data]. We don’t need the ;charset=utf-8 parameter (or the invalid ;utf8 parameter…), because URLs are always ASCII."