Skip to content

Instantly share code, notes, and snippets.

View hirasso's full-sized avatar
👋

Rasso Hilber hirasso

👋
View GitHub Profile
@hirasso
hirasso / install-wp-plugin-from-github-latest.sh
Last active October 29, 2024 08:59
Install a WordPress plugin from the latests GitHub release
#!/bin/bash
# Function to download and extract the latest release ZIP of a GitHub
# repository to the current WordPress install's plugin directory
download() {
# Split the first argument into repo_owner and repo_name
local repo_full="$1"
local repo_owner="${repo_full%/*}"
local repo_name="${repo_full#*/}"
local plugin_dir=$(wp eval 'echo WP_PLUGIN_DIR;')
@hirasso
hirasso / acf-oembed-cache.php
Last active February 29, 2024 12:27
Cache oEmbed responses in WordPress when using Advanced Custom Fields
<?php
/**
* Plugin Name: ACF oEmbed Cache
* Description: Cache ALL ACF oEmbed responses, no matter in what context
* Version: 1.0.0
* Requires PHP: 8.0
* Author: Rasso Hilber
* Author URI: https://rassohilber.com/
*/
@hirasso
hirasso / ForceLowercaseURLs.php
Last active August 12, 2024 01:14
WordPress: Force Lowercase URLs
<?php
/**
* Plugin Name: Force Lowercase URLs
* Description: Redirect uppercase URLs to their lowercase counterpart.
* Version: 1.0.0
* Requires PHP: 8.0
* Author: Rasso Hilber
* Author URI: http://rassohilber.com/
*/
@hirasso
hirasso / lqip.ts
Last active October 19, 2023 10:14
Render low quality image placeholders using BlurHash or ThumbHash base46 strings (TypeScript)
import { decodeBlurHash } from 'fast-blurhash';
import { thumbHashToRGBA } from 'thumbhash';
/**
* Render low quality image placeholders using ThumbHash
*
* thumbHashToRGBA() expects a Unit8Array. What we have is a base64 representation,
* so we first need to convert that so that thumbHashToRGBA can actually consume it
* @see https://github.com/evanw/thumbhash/issues/18#issuecomment-1484243562
*/
@hirasso
hirasso / ACFSyncFieldGroups.php
Last active November 8, 2024 08:10
A WordPress Plugin that allows to sync ACF field groups via WP CLI
<?php
/*
* Plugin Name: ACFSyncFieldGroups
* Plugin URI: https://gist.github.com/hirasso/c48c04def92f839f6264349a1be773b3
* Description: Allows to sync ACF field groups via WP CLI
* Version: 0.0.2
* Author: Rasso Hilber
* Author URI: https://rassohilber.com/
* License: GPL2+
* License URI: https://www.gnu.org/licenses/gpl-2.0.txt
@hirasso
hirasso / WpscHtaccessHelper.php
Last active December 16, 2022 10:01
A WordPress plugin to modify the .htaccess file generated by WP Super Cache
<?php
/*
* Plugin Name: WP Super Cache Htaccess Helper
* Plugin URI: https://gist.github.com/hirasso/254c5ca2f7464d7b65d3905524bb755d
* Description: Modifies WP Super Caches .htaccess file.
* Version: 0.0.1
* Author: Rasso Hilber
* Author URI: https://rassohilber.com/
* License: GPL2+
* License URI: https://www.gnu.org/licenses/gpl-2.0.txt