Skip to content

Instantly share code, notes, and snippets.

--- /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() );
@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");
<?php
ob_start(function ($html) {
return preg_replace(
'~http://((www\.)?landvancuijkboertbewust|nieuw\.boertbewust\.nl)\.nl\b~i',
'https://www.landvancuijkboertbewust.nl',
$html
);
});
#!/usr/bin/env bash
set -euo pipefail
check_bin() {
if [[ ! -f $BIN/$1 ]]; then
echo "$1 not found in $BIN" >&2
exit 1
fi
}
#!/usr/bin/env bash
set -euo pipefail
check_bin() {
if [[ ! -f $BIN/$1 ]]; then
echo "$1 not found in $BIN" >&2
exit 1
fi
}
#!/usr/bin/env bash
set -euo pipefail
check_bin() {
if [[ ! -f $BIN/$1 ]]; then
echo "$1 not found in $BIN" >&2
exit 1
fi
}
albert@ishtar ~ % ab -m POST -n 40 -c 4 'https://ht.kibohost.com/'
This is ApacheBench, Version 2.3 <$Revision: 1604373 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking ht.kibohost.com (be patient).....done
Server Software: nginx/1.12.0
Server Hostname: ht.kibohost.com

Keybase proof

I hereby claim:

  • I am apeschar on github.
  • I am albertp (https://keybase.io/albertp) on keybase.
  • I have a public key whose fingerprint is 8022 5695 D993 CBE0 F57E 5DB2 D347 28F2 F58C 3490

To claim this, I am signing this object:

<?php
// Implementation of Conway's game of life in PHP
// Incomplete and buggy ;)
$board = "
-------------------
-------------------
-------------------
-------------------