This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Images in post galleries | |
add_filter( 'get_post_galleries', '_img_url_filter', PHP_INT_MAX ); | |
add_filter( 'widget_media_image_instance', '_img_url_filter', PHP_INT_MAX ); | |
// Core image retrieval | |
add_filter( 'image_downsize', '_img_url_filter', 10, 3 ); | |
// Responsive image srcset substitution |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Convert Alfred Snippets to Espanso matches | |
* | |
* @see https://www.alfredapp.com/help/features/snippets/ | |
* @see https://espanso.org/ | |
*/ | |
define('SNIPPETS_DIR', '/path/to/export/of/Alfred/snippets/'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
// ✅ will work | |
add_shortcode('rocktheboat', function () { | |
ob_start(); | |
echo " Hello world"; | |
return ob_get_clean(); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
// ❌ won't work, will show at top of page | |
add_shortcode('rocktheboat', function () { | |
echo "hello world"; | |
}); | |
// ✅ will work, will replace shortcode with returned text | |
add_shortcode('rocktheboat', function () { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"100" : { | |
"title": "Continue", | |
"description": "Client should continue with request." | |
}, | |
"101" : { | |
"title": "Switching Protocols", | |
"description": "Server is switching protocols." | |
}, | |
"102" : { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<body onload="showOrHideAlert()"> | |
<div id='alert' style="background:yellow"> | |
Alert banner generated by PHP, always in the HTML | |
<a id='alert_dismiss' onclick="setDismissAlertCookie()">[X]</a> | |
</div> | |
<script> | |
function showOrHideAlert() { | |
const hidden = document.cookie.split('; ').find(row => row.startsWith('dismissAlert='))?.split('=')[1]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#$1 is the first parameter being passed when calling the script. The variable filename will be used to refer to this. | |
FILENAME=$1 | |
DSCA_LOCALHOST_ADDR="" | |
echo "🏃 doing r+r" | |
# s+r https to http (until I get a RP setup locally) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# install: | |
# | |
# 1. create a file with this gists contents | |
# $ vi ~/.oh-my-zsh/themes/dollarsign-minimal.zsh-theme | |
# | |
# 2. edit ~/.zshrc and set `ZSH_THEME="dollarsign-minimal"` | |
# $ vi ~/.zshrc | |
# | |
# 3. reload zshrc | |
# $ source ~/.zshrc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
// this is to be put in a single site/plugin.. not network wide. | |
// if it's network wide it will run a `transient` for each site. which'd be ridiculous | |
// it only needs to run in a single site enviroment | |
add_action('init', 'update_super_admins_access'); | |
function update_super_admins_access() { | |
// since this is a big thing to do, we can run a test and see whats | |
// going to happen before it does | |
$test = false; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
// settings | |
$url = "https://example.com/queryforjson"; // json source | |
$cache = __DIR__."/json.cache"; // make this file in same dir | |
$force_refresh = false; // dev | |
$refresh = 60*60; // once an hour | |
// cache json results so to not over-query (api restrictions) | |
if ($force_refresh || ((time() - filectime($cache)) > ($refresh) || 0 == filesize($cache))) { |
NewerOlder