Skip to content

Instantly share code, notes, and snippets.

View justrustyspoons's full-sized avatar
🙃

Rusty justrustyspoons

🙃
View GitHub Profile
@justrustyspoons
justrustyspoons / rules.md
Last active November 15, 2026 13:15
Rules for AI

Project Rules (Highest Priority):

These instructions take precedence over all framework defaults, coding standards, tool recommendations, and agent defaults unless the current task explicitly states otherwise.

This application runs in Laravel Sail (Docker). Run all Laravel, PHP, Composer, or project tooling inside the Sail container by prefixing them with sail, for example: vendor/bin/sail artisan route:list and vendor/bin/sail pint. Always invoke Sail as vendor/bin/sail … — never ./vendor/bin/sail …. This exact spelling is required because Codex’s outside-sandbox approval rule matches the argument prefix vendor/bin/sail. Adding ./ prevents that rule from matching.

When a command fails, preserve its full output and exit status before filtering. Report the actual error, investigate generic messages before attributing a cause, and state when the cause is unknown.

Implementation

<?php
namespace App\Traits;
use Hashids\Hashids;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Casts\Attribute;
use Illuminate\Support\Str;
trait Hashid
@justrustyspoons
justrustyspoons / prepare
Last active September 1, 2024 10:23
Bash script to prepare a Laravel Sail app for deployment
#!/bin/bash
Help() {
echo "Prepare the app for deployment."
echo "This script will run Pint, generate Ziggy routes, and then run Prettier, before adding all changed files for committing."
echo
echo "Syntax: prepare [pint|ziggy|pretier|h|help]"
echo "options:"
echo "pint Format PHP files with Pint."
echo "ziggy Generate Ziggy routes."
echo "prettier Format front end files with Prettier."
@justrustyspoons
justrustyspoons / platform.js
Created September 10, 2022 13:13
Get platform and standalone mode
isInStandaloneMode() {
return (window.matchMedia("(display-mode: standalone)").matches) ||
(("standalone" in window.navigator) && (window.navigator.standalone));
}
isMac() {
return /(macintosh|macintel|macppc|mac68k|macos)/i.test(window.navigator.userAgent.toLowerCase());
}
isIos() {
return /iphone|ipad|ipod/i.test(window.navigator.userAgent.toLowerCase());
}
@justrustyspoons
justrustyspoons / generate-ssh-key.sh
Created March 31, 2020 16:05 — forked from grenade/01-generate-ed25519-ssh-key.sh
Correct file permissions for ssh keys and config.
ssh-keygen -t rsa -b 4096 -N '' -C "rthijssen@gmail.com" -f ~/.ssh/id_rsa
ssh-keygen -t rsa -b 4096 -N '' -C "rthijssen@gmail.com" -f ~/.ssh/github_rsa
ssh-keygen -t rsa -b 4096 -N '' -C "rthijssen@gmail.com" -f ~/.ssh/mozilla_rsa
@justrustyspoons
justrustyspoons / mobile-friendly-bootstrap-modals-bottom-sheet.scss
Created September 19, 2019 10:45
A Sass snippet to make bootstrap modals more mobile friendly by turning them into a 'bottom sheet' on smaller screens
.modal {
display: flex;
align-items: flex-end;
&.fade {
.modal-dialog-bottom {
position: absolute;
bottom: 0;
transition: transform 0.4s;