Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env bash
set -euo pipefail
check_bin() {
if [[ ! -f $BIN/$1 ]]; then
echo "$1 not found in $BIN" >&2
exit 1
fi
}
<?php
ob_start(function ($html) {
return preg_replace(
'~http://((www\.)?landvancuijkboertbewust|nieuw\.boertbewust\.nl)\.nl\b~i',
'https://www.landvancuijkboertbewust.nl',
$html
);
});
@apeschar
apeschar / dark-theme-fix.php
Created May 25, 2021 07:05
Attempt to fix Twenty Twenty One dark theme flash when using PhastPress
<?php
// Either save this entire file as dark-theme-fix.php and put it inside
// wp-content/mu-plugins (you may have to create this directory),
// or manually add the script tag to your HTML <HEAD>.
add_action('wp_head', function () { ?>
<script data-phast-no-defer>
if (window.matchMedia("(prefers-color-scheme: dark)").matches) {
document.documentElement.classList.add("is-dark-theme");
--- /tmp/raq/request-quote-table-old.php 2022-09-13 15:21:33.046041261 +0000
+++ /tmp/raq/request-quote-table-new.php 2022-09-13 15:21:25.442164874 +0000
@@ -122,6 +122,12 @@
if ( ! empty( $attributes ) ) {
foreach ( $attributes as $name => $value ) {
+ if ( $value instanceof WC_Product_Attribute ) {
+ $value = array_map( function ( $term ) {
+ return $term->name;
+ }, $value->get_terms() );