Skip to content

Instantly share code, notes, and snippets.

View aklump's full-sized avatar

Aaron Klump aklump

View GitHub Profile
@aklump
aklump / RotateImageDataURI.php
Last active September 16, 2024 21:36
Invokable class to rotate an image data URI
<?php
use InvalidArgumentException;
/**
* Rotate an image DataURI string.
*
* Because I'm working with a string, not a file, the Drupal image API
* (image.factory) didn't seem to be an appropriate solution, therefor I'm using
* the native PHP GD library.
*/
@aklump
aklump / GetShortPath.php
Created October 30, 2024 21:53
Create a pretty/short path, removing CWD or basepath.
<?php
/**
* @code
* // Print a shortened, nice-to-read path when possible.
* echo (new GetShortPath(getcwd())($long_path)
* @endcode
*/
class GetShortPath {
@aklump
aklump / xdebug_controller.sh
Last active February 18, 2025 00:07
Xdebug Lando Controller
#!/usr/bin/env bash
#
# @file
# Xdebug Lando Controller (Supports Xdebug versions 2 and 3)
#
# Save this file to: ./install/lando/xdebug_controller.sh.
#
# This script is meant to be used for Lando tooling to control Xdebug. When
# using with version 2, use the version 3 syntax and it will be properly
@aklump
aklump / todo.md
Created March 5, 2025 20:08
Task list scaffolding.

Critical

Normal

Complete

@aklump
aklump / vendor_autoload.php
Created April 30, 2025 21:41
snippet to load composer autoload
// https://getcomposer.org/doc/articles/vendor-binaries.md#finding-the-composer-autoloader-from-a-binary
if (isset($GLOBALS['_composer_autoload_path'])) {
// As of Composer 2.2...
$_composer_autoload_path = $GLOBALS['_composer_autoload_path'];
}
else {
// < Composer 2.2
foreach ([
__DIR__ . '/../../autoload.php',
__DIR__ . '/../vendor/autoload.php',