Skip to content

Instantly share code, notes, and snippets.

View Radiergummi's full-sized avatar

Moritz Mazetti Radiergummi

View GitHub Profile
@Radiergummi
Radiergummi / routes.d.ts
Last active January 8, 2026 22:01
Laravel Route replacement in Frontend code at build-time
import { type RouteParameters, type Routes } from '$api/routes.js';
/**
* Resolve a route without parameters
*
* Takes the name of a route as defined in the Laravel application and returns
* the URI of the endpoint.
*
* @param name Route name
*/
@Radiergummi
Radiergummi / App.vue
Last active January 7, 2026 06:44
A Vue directive to react to something being dragged on the browser window. Port of this Stack Overflow answer: https://stackoverflow.com/a/55392885/2532203
<template>
<div v-dragging="{ enter, leave }">
</div>
</template>
<script>
import './dragging.ts';
export default {
methods: {
@Radiergummi
Radiergummi / build.yml
Created November 8, 2025 15:12
Conditional builds based on context hash
name: Build
on:
workflow_call:
outputs:
image-name:
description: Name of the Docker image built
value: ${{ jobs.finalize.outputs.image-name }}
version:
description: Version of the Docker image built
import type { Client, Database } from '$lib/server/database';
import type { Insertable, Selectable } from 'kysely';
const table = 'authentication.challenge' as const;
export async function resolveCurrentChallenge(
client: Client,
identifier: string
) {
const { challenge, expires_at } = await client
@Radiergummi
Radiergummi / lcid-16.json
Created May 29, 2025 15:47
A list of LCID 16.0 locales
[
{
"language": "Afar",
"location": null,
"id": null,
"tag": "aa"
},
{
"language": "Afar",
"location": "Djibouti",
@Radiergummi
Radiergummi / README.md
Last active April 27, 2025 22:12
Docker Swarm Deployment

This is the deployment runner script we use in our BitBucket pipelines. It does the following things, in this order:

  1. Sign in to Docker Hub
    So we can download images and propagate authentication to Swarm nodes. This connects to the connection in DOCKER_HOST (defaulting to the Docker socket), so you can also run this within a deployment container - see below for more.
  2. Expand secrets and configs
    To configure services, we can use configs and secrets to let the swarm engine mount those values securely
@Radiergummi
Radiergummi / Cryptor.php
Last active June 24, 2024 19:54
A PHP class to encrypt and decrypt strings using a static application secret. Input is converted to hex strings to enable easier handling
<?php
namespace Vendor\Library;
use function bin2hex;
use function hex2bin;
use function openssl_decrypt;
use function openssl_encrypt;
use function random_bytes;
@Radiergummi
Radiergummi / deployment.sh
Last active March 18, 2024 19:54
RabbitMQ configuration
#!/usr/bin/env sh
export DOCKER_HOST=unix:///var/run/docker.sock
docker_hosts=$(docker node ls --format '{{.Hostname}}')
# Retrieve the list of hosts from the Docker node (needs to run
# within the Swarm).
# We use this list to configure RabbitMQ statically: On every node
# in the cluster, a RabbitMQ instance is running. They are
# configured to use the Swarm node hostname as their hostname; so

Keybase proof

I hereby claim:

  • I am Radiergummi on github.
  • I am radiergummi (https://keybase.io/radiergummi) on keybase.
  • I have a public key whose fingerprint is E221 7CF8 EE59 2CB0 9F03 A1C8 B315 6A31 942E 83A6

To claim this, I am signing this object:

@Radiergummi
Radiergummi / ArtisanServeFormatter.php
Last active November 7, 2023 07:22
Formatter for Laravel's artisan serve command that will preserve log output
<?php
declare(strict_types=1);
namespace App\Support;
use DateTime;
use Monolog\Formatter\FormatterInterface;
use Monolog\Formatter\LineFormatter;
use Monolog\LogRecord;