Skip to content

Instantly share code, notes, and snippets.

@mike-moreau
mike-moreau / nginx.conf
Created September 16, 2025 18:36
Block access to admin.php by IP address in NGINX (Laravel Forge)
# FORGE CONFIG (DO NOT REMOVE!)
include forge-conf/www.example.com/before/*;
server {
location /admin {
allow 123.456.789.001; # your ip here
deny all;
try_files $uri $uri/ /index.php?$query_string;
@mike-moreau
mike-moreau / query.sql
Created September 11, 2025 01:56
Sort MySQL tables by their size
SELECT
table_schema as `Database`,
table_name AS `Table`,
round(((data_length + index_length) / 1024 / 1024), 2) `Size in MB`
FROM information_schema.TABLES
ORDER BY (data_length + index_length) DESC
@mike-moreau
mike-moreau / config
Created July 9, 2025 18:51
mac ssh config file examples
# ~/.shh/config
# Defaults for all hosts
Host *
UseKeychain yes
AddKeysToAgent yes
Host github.com
IdentityFile ~/.ssh/id_github
@mike-moreau
mike-moreau / nginx.conf
Created July 1, 2025 14:16
Creating a redirect from a Laravel Forge site using nginx config only
# FORGE CONFIG (DO NOT REMOVE!)
include forge-conf/oldsite.com/before/*;
server {
http2 on;
listen 443 ssl;
listen [::]:443 ssl;
server_name oldsite.com;
server_tokens off;
root /home/forge/oldsite.com/public;
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
@mike-moreau
mike-moreau / prose.css
Created March 12, 2025 15:36
TailwindCSS 4 Typography Plugin Replacement Utility
@layer base {
:root {
--tw-prose-body: var(--color-gray-900);
--tw-prose-headings: var(--color-brand-blue);
--tw-prose-lead: var(--color-gray-900);
--tw-prose-links: var(--color-brand-cyan-a11y-any);
--tw-prose-bold: var(--tw-prose-body);
--tw-prose-counters: var(--tw-prose-body);
--tw-prose-bullets: var(--color-brand-gold);
--tw-prose-hr: var(--color-gray-400);
@mike-moreau
mike-moreau / biome.json
Created January 10, 2025 17:52
Biome Config File
{
"$schema": "https://biomejs.dev/schemas/1.9.4/schema.json",
"vcs": {
"enabled": false,
"clientKind": "git",
"useIgnoreFile": false
},
"files": {
"ignoreUnknown": false,
"ignore": []
@mike-moreau
mike-moreau / layout.twig
Created December 16, 2024 19:46
Non-blocking web font rendering for performance based on Craft CMS .env vars
{# Non-blocking Web Fonts - check to ensure display:swap is also used #}
{% if getenv('ADOBE_FONTS_URL') %}
<link rel="preconnect" href="https://use.typekit.net" crossorigin>
<link rel="preconnect" href="https://p.typekit.net" crossorigin>
<link rel="preload" href="{{ getenv('ADOBE_FONTS_URL') }}" as="style">
<link rel="stylesheet" href="{{ getenv('ADOBE_FONTS_URL') }}" media="print" onload="this.media = 'all'" />
<noscript>
<link rel="stylesheet" href="{{ getenv('ADOBE_FONTS_URL') }}">
</noscript>
{% endif %}
@mike-moreau
mike-moreau / how-to-look-up-dns.sh
Last active December 14, 2024 03:07
How to look up DNS from Terminal
# Look up DNS records in Terminal - dig or nslookup
$ dig example.com ANY
$ host example.com
$ nslookup -type=any example.com
$ nslookup -type=A example.com
$ nslookup -type=CNAME example.com
$ nslookup -type=TXT example.com
$ nslookup -type=MX example.com
@mike-moreau
mike-moreau / deploy.sh
Last active January 24, 2025 21:34
An example deployment script for Craft CMS projects not using a deployment service.
#!/bin/bash
# Run this script from the project root:
# Usage: deploy.sh <branch-name:string> [build-assets=true]
# Example - Deploy staging (with assets building by default): `bash ./deploy.sh staging`
# Example - Deploy main without building assets: `bash ./deploy.sh main false`
# Check if a branch name argument is provided
if [ $# -eq 0 ]; then
echo "Error: Branch name argument is required"