Skip to content

Instantly share code, notes, and snippets.

View jasperf's full-sized avatar
🏠
Working from home

Jasper Frumau jasperf

🏠
Working from home
View GitHub Profile
@jasperf
jasperf / rsync.sh
Last active April 23, 2025 03:37
Rsync Theme from Trellis setup to Theme repository
#!/bin/bash
rsync -av --delete \
--exclude 'node_modules/' \
--exclude 'vendor/' \
--exclude '.git/' \
--exclude '.github/' \
--exclude '.DS_Store' \
~/code/site.com/site/web/app/themes/theme-name/ \
~/code/site/
@jasperf
jasperf / setup-package.sh
Last active April 18, 2025 05:28
Acorn Package Renaming Script
#!/bin/bash
# --- Configuration ---
DRY_RUN=false
# --- Helper Functions ---
# Helper function for cross-platform sed
safe_sed() {
local pattern="$1"
local replacement="$2"
@jasperf
jasperf / acf-composer-vs-block-patterns.md
Last active April 15, 2025 02:39
ACF Composer Blocks vs Block Patterns in Nynaeve Theme

🛠️ ACF Composer vs. Block Patterns in setup.php

🔍 Overview

ACF Composer (by Log1x) excels at defining ACF Blocks and Field Groups in a structured, object-oriented way using PHP classes.

While you could use ACF Composer to register block patterns, it doesn’t offer a significant advantage over your current method via setup.php — especially when it comes to layout-based patterns.


@jasperf
jasperf / versioning.md
Last active April 4, 2025 03:15
By following this Git versioning scheme, you ensure that the latest version always appears at the top of the list in Packagist.

To ensure that the versions are listed in the correct order with the latest on top in Packagist, you should follow semantic versioning and use proper pre-release identifiers. Here are some recommendations:

  1. Semantic Versioning: Follow semantic versioning (SemVer) strictly. The format is MAJOR.MINOR.PATCH, where:

    • MAJOR version increments for incompatible changes.
    • MINOR version increments for backward-compatible functionality.
    • PATCH version increments for backward-compatible bug fixes.
  2. Pre-release Identifiers: Use pre-release identifiers (e.g., alpha, beta, rc) with a numeric suffix to maintain proper order. The format is MAJOR.MINOR.PATCH-<identifier>.<number>.

  3. Release Order: Ensure that the versions increment logically so that Packagist can sort them correctly.

@jasperf
jasperf / user-ownership-management-amazon-sail.sh
Last active January 15, 2025 04:52
User and ownership management to work with group www-data and user ubuntu on Amazon Sail setup
/**
* Amazon Sail User and Ownership Management Setup
*
* User Management: Adds ubuntu to the www-data group for group-based access.
* Ownership Management:
* Changes ownership of site directories to the appropriate users and groups (www-data and ubuntu).
* Permissions Management:
* Ensures that www-data has write access to the directories using g+w, which allows group members to modify files in the
* directory.
* Enforces consistent group ownership with g+s, ensuring new files and directories inherit the parent directory’s
@jasperf
jasperf / multisite-lando-config.yml
Created January 14, 2025 03:59 — forked from kyletaylored/multisite-lando-config.yml
Lando WordPress Network Site / Multisite (WPMS)
# Using the pantheon recipe / wordpress_network framework, we add a config to the
# appserver_nginx service to use our own server and vhost files. Copy the files lando
# uses and on the wordpress_network.conf.tpl and added wp/ to the rewrite
# rules so lando knows where our WP files live within our Bedrock setup.
appserver_nginx:
type: nginx
ssl: true
config:
server: 'private/config/lando/nginx.conf.tpl'
@jasperf
jasperf / wp-regenerate-w-limited-resources.sh
Last active January 10, 2025 02:47
wp media regenerate for adding missing image formats & limiting virtual memory and cpu core usage #wpcli #bash #imageregeneration
# use wp cli to regenerate missing image formats while limiting RAM and CPU usage so server does not die on you during the ride
# check whether virtual memory has been set for this bash session
ulimit -v 2097152
# check whether virtual memory has been set for this bash session
ulimit -v
# install cpu limit application on debian / ubuntu
sudo apt install cpulimit
# run command to regenerate missing thumbnails with virtual memory and only half a cpu core
cpulimit -l 50 -- wp media regenerate --yes --only-missing
Uncaught TypeError: Cannot read properties of undefined (reading 'timepicker')
at jquery-ui-timepicker-addon.min.js?ver=1.6.1:4:132
at jquery-ui-timepicker-addon.min.js?ver=1.6.1:4:85
at jquery-ui-timepicker-addon.min.js?ver=1.6.1:4:95Understand this errorAI
menu.min.js?ver=1.13.3:9 Uncaught TypeError: a.widget is not a function
at menu.min.js?ver=1.13.3:9:223
at menu.min.js?ver=1.13.3:9:178
at menu.min.js?ver=1.13.3:9:188Understand this errorAI
autocomplete.min.js?ver=1.13.3:9 Uncaught TypeError: o.widget is not a function
at autocomplete.min.js?ver=1.13.3:9:217
@jasperf
jasperf / expire-headers-cache-control.sh
Created December 16, 2024 02:05
Check for expire headers and cache control for one single page
for url in $(curl -s https://autentical.nl/hoe-krijg-je-kaartjes-voor-de-caminito-del-rey/ | \
grep -Eo '(http|https)://[^"]+\.(js|css|jpg|jpeg|png|gif|woff|woff2|ttf|svg|eot)'); do
echo "Checking: $url"
curl -sI "$url" | grep -Ei 'cache-control|expires'
done
Checking: https://autentical.nl/wp-content/plugins/wd-google-maps/css/bootstrap.css
cache-control: max-age=31536000, public
expires: Tue, 16 Dec 2025 01:31:36 GMT
Checking: https://autentical.nl/wp-content/plugins/wd-google-maps/css/frontend_main.css
@jasperf
jasperf / optimize-tiqets-widget-loading.php
Created December 9, 2024 04:39
Optimize Tiqets widget loading
<?php
/**
* Optimize Tiqets widget loading by:
* 1. Adding resource hints (preconnect/dns-prefetch) for faster initial connection
* 2. Using Intersection Observer to detect when widgets come into viewport
* 3. Loading the Tiqets loader script only once when first widget becomes visible
* 4. Removing duplicate loader scripts from content
*
* Benefits:
* - Reduces initial page load by deferring widget loading