Skip to content

Instantly share code, notes, and snippets.

View ceilidhboy's full-sized avatar

Mike Scott ceilidhboy

View GitHub Profile
@ceilidhboy
ceilidhboy / pest-worktree-fix.md
Last active July 13, 2026 20:28
Setup: forked Pest for git worktree / symlinked vendor support

How to Use the Forked Pest for Git Worktree / Symlinked Vendor Support

Symptoms

If you're running Pest tests in a git worktree and seeing failures like:

  • A facade root has not been set.
  • Call to undefined method ...::get() (or post(), put(), etc.)
  • Vite manifest not found at: .../develop/public/build/manifest.json
  • Test class names prefixed with the filesystem path instead of Tests\ (e.g. P\Home\user\...\tests\Feature\...)
@ceilidhboy
ceilidhboy / git-safe-rebase-alias.md
Last active June 3, 2026 14:51
git safe-rebase alias — check before you rebase

git safe-rebase alias

A git alias that checks whether it's safe to rebase your current branch onto a target branch, without actually running the rebase.

What problem does this solve?

The most common workflow mistake is rebasing onto your local master when it's stale — either because you forgot to pull, or because someone else pushed in the few seconds since you did. This leaves you in a state where git status says:

Your branch and 'origin/master' have diverged,
@ceilidhboy
ceilidhboy / axios-vulnerability-scan.sh
Last active April 18, 2026 11:42
BASH script to scan for compromised axios package (v1.14.1)
#!/bin/bash
# by Mike Scott 18-Apr-26
COMPROMISED_AXIOS="1.14.1"
COMPROMISED_AXIOS_OLD="0.30.4"
COMPROMISED_PLAIN_CRYPTO="4.2.1"
RED='\033[0;31m'
GREEN='\033[0;32m'
AMBER='\033[0;33m'
@ceilidhboy
ceilidhboy / add-composer-run-dev.md
Last active May 8, 2026 12:54
Add new `composer run dev` command to existing Laravel app

The composer run dev command was added in Laravel 11.28 but it doesn't get added automatically to projects that were created with an earlier Laravel version and then upgraded beyond 11.28.

To add the command, edit composer.json and add the following to the "scripts" section after the last script entry:

,
        "dev": [
            "Composer\\Config::disableProcessTimeout",
 "npx concurrently -c \"#93c5fd,#c4b5fd,#fb7185,#fdba74\" \"php artisan serve\" \"php artisan queue:listen --tries=1 --timeout=0\" \"php artisan pail --timeout=0\" \"npm run dev\" --names=server,queue,logs,vite --kill-others"
@ceilidhboy
ceilidhboy / www.nginx.md
Created April 13, 2024 20:10
Add a www redirect to nginx configuration

Add the following block before the existing server block, in the nginx configuration, where domain-name.com is the domain of the website:

server {
        server_name www.domain-name.com;
        return 301 $scheme://domain-name.com$request_uri;
}
@ceilidhboy
ceilidhboy / defining-config-constants.md
Created November 10, 2023 10:58
How to define constants safely in Laravel config files

Doing a simple CONST declaration in config files can cause errors when enabling caching in Laravel. The config file appears to be loaded more than once and the second time causes an error because the constant is already defined.

The safe way to do it is to use the old syntax and only try to define the constant if it has not already been defined, as the following example shows:

<?php

use Illuminate\Support\Facades\Facade;

How to upload files, e.g. MySQL database export

  • In a terminal, install gdown with pip install gdown
  • Upload the file you want to send to the server to Google drive
  • Copy the "anyone with link" share link for the file
  • Paste it into notepad and copy the file ID from the link
  • cd to the directory you want the file to go (or use the -O <path> option with gdown)
  • Download the file with ~/.local/bin/gdown
@ceilidhboy
ceilidhboy / config
Last active September 22, 2022 20:01
.ssh config file for web servers for connecting to GitHub
Host github.com
Hostname github.com
IdentityFile=~/.ssh/id_rsa_GitHub
@ceilidhboy
ceilidhboy / z.sh
Last active August 29, 2022 12:55
cd command on steroids! Place in ~/bin and set execute flag. See file comments for installation and command options.
# Copyright (c) 2009 rupa deadwyler. Licensed under the WTFPL license, Version 2
# maintains a jump-list of the directories you actually use
#
# INSTALL:
# * put something like this in your .bashrc/.zshrc:
# . /path/to/z.sh
# * cd around for a while to build up the db
# * PROFIT!!
# * optionally:
@ceilidhboy
ceilidhboy / ClearLaravelLog.php
Last active July 24, 2022 20:06
Laravel Artisan command to clear the laravel.log file. Usage: php artisan log:clear
<?php
namespace App\Console\Commands\Log;
use Illuminate\Console\Command;
class ClearLogFile extends Command
{
protected $signature = 'log:clear';