Skip to content

Instantly share code, notes, and snippets.

View Braunson's full-sized avatar

Braunson Yager Braunson

View GitHub Profile
@Braunson
Braunson / pizza-calculator.html
Created April 10, 2025 22:56
Pizza Dough calculator build with Tailwind CSS & Alpine.js. Initially inspired + based on https://doughguy.co
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Pizza Dough Calculator</title>
<script defer src="https://cdn.jsdelivr.net/npm/[email protected]/dist/cdn.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4"></script>
<!-- Print-only styles -->
@Braunson
Braunson / index.html
Created February 13, 2025 23:34
Zero-install, zero dependencies, high-performance API testing tool using Alpine.js and Tailwind CSS
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>API Request Builder</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/alpinejs/3.13.5/cdn.min.js" defer></script>
<script src="https://unpkg.com/@tailwindcss/browser@4"></script>
</head>
<body class="bg-gray-100 min-h-screen p-4">
@Braunson
Braunson / index.html
Created February 12, 2025 20:31
JSON Path Explorer built with Alpine.js + Tailwind
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>JSON Path Explorer</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/alpinejs/3.13.5/cdn.min.js" defer></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.21/lodash.min.js"></script>
<script src="https://unpkg.com/@tailwindcss/browser@4"></script>
</head>
@Braunson
Braunson / bookmarklet.js
Last active February 11, 2025 19:55
Quickly generate a form filler bookmarklet!
// Save this as a bookmark in your browser for the next time you want to fill in the page form!
javascript:(function() {
const fillValues = {
// Paste the object in here from the previous command
}
function fillField(element, value) {
if (!element) return;
// Handle different input types
@Braunson
Braunson / ExportTwillBlocks.php
Created January 31, 2025 19:30
Twill CMS Block exporter to JSON (WIP) - Export Twill blocks both custom and default to JSON with their respective field types and names
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\File;
use Illuminate\Support\Str;
use ReflectionClass;
use ReflectionMethod;
use Symfony\Component\Finder\Finder;
@Braunson
Braunson / console-table-clone.js
Created December 16, 2024 17:48
console.table behavior in a custom JS function
function customConsoleTable(data) {
// Handle GroupBy results by flattening them appropriately
function flattenGroupBy(groupedData) {
if (!groupedData || typeof groupedData !== 'object') return groupedData;
// Check if this looks like a GroupBy result
const isGroupByResult = Object.values(groupedData).every(Array.isArray);
if (!isGroupByResult) return groupedData;
// Flatten the grouped structure
@Braunson
Braunson / commands.sql
Created November 8, 2024 17:18
Changing the prefix of tables on a existing WordPress site
-- So you have an existing WP website with a prefix you need to change
-- We will need to do more than just updating the wp-config.php prefix.
-- There are row data that reference table names we'll need to update
-- Assuming we're already using the wp_ prefix and for example want to
-- change to xyzwp_ we'll need to update the data within the tables
-- Update user meta references
UPDATE wp__usermeta
SET meta_key = REPLACE(meta_key, 'wp_', 'xyzwp_')
@Braunson
Braunson / functions.php
Last active October 15, 2024 00:42
WordPress - Create a custom Settings > Theme Settings page
<?php
/**
* Class WP_Geekybeaver_Theme_Settings
*
* Configure the plugin settings page.
*/
class WP_Geekybeaver_Theme_Settings
{
/**
@Braunson
Braunson / composer.json
Created October 9, 2024 15:03
Copy .env.example to .env and generate an APP_KEY when not set on the Composer post-install-cmd hook
{
"scripts": {
"post-install-cmd": [
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\"",
"@php -r \"if (strlen(trim(file_get_contents('.env'))) > 0 && !preg_match('/^APP_KEY=.+/m', file_get_contents('.env'))) { echo shell_exec('php artisan key:generate --ansi'); }\"",
"@php -r \"file_exists('database/database.sqlite') || touch('database/database.sqlite');\""
]
}
}
@Braunson
Braunson / .env
Created October 8, 2024 21:03
Support for auto-creating the env defined bucket for Minio with Laravel Sail
AWS_ACCESS_KEY_ID=sail
AWS_SECRET_ACCESS_KEY=password
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=local
AWS_ENDPOINT=http://minio:9000
AWS_USE_PATH_STYLE_ENDPOINT=true