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 | |
/** | |
* Register scripts with a `defer` or `async` strategy in a backwards compatible manner. | |
* | |
* From WordPress 6.3 onwards, the `wp_register_script` function accepts an `$args` array that | |
* can include a `strategy` key with a value of either `async` or `defer`. | |
* | |
* This helper function handles the backwards compatibility for older versions of WordPress. When a | |
* `strategy` key is present in the `$args` array (and is either `defer` or `async`), the |
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 | |
/** | |
* Plugin Name: Hook Counter | |
* Author: Weston Ruter | |
* Description: Drop in mu-plugins and see a markdown table at the end of a page's source code counting all hooks invoked more than once. | |
*/ | |
$hook_counts = []; | |
add_filter( 'all', static function ( $hook_name ) use ( &$hook_counts ) { |
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
{"foo": "bar"} |
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
<!-- wp:paragraph --> | |
<p>These are the emoji which are tested for in <code>emoji-loader.js</code>:</p> | |
<!-- /wp:paragraph --> | |
<!-- wp:columns {"align":"wide"} --> | |
<div class="wp-block-columns alignwide"><!-- wp:column --> | |
<div class="wp-block-column"><!-- wp:paragraph {"fontSize":"xx-large"} --> | |
<p class="has-xx-large-font-size">🏳️⚧️</p> | |
<!-- /wp:paragraph --> |
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 | |
/** | |
* Optimize Loading Separate Core Block Assets in Classic Themes Plugin. | |
* | |
* @package OptimizeLoadingSeparateCoreBlockAssetsInClassicThemes | |
* @author Weston Ruter | |
* @link https://gist.github.com/westonruter/25187db63a7666f08b151ca53497ffb5 | |
* @license GPL-2.0-or-later | |
* @copyright 2023 Google Inc. | |
* |
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 | |
/** | |
* Make YouTube Accessible Embed Plugin | |
* | |
* @package TBK_YouTube_Embed_Mods | |
* @author Weston Ruter | |
* @link https://gist.github.com/westonruter/8199d0fcb417a909380b0aeff4247cf7 | |
* @license GPL-2.0-or-later | |
* @copyright 2023 Google Inc. | |
* |
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 | |
require_once __DIR__ . '/functions.php'; | |
require_once __DIR__ . '/_wp_normalize_relative_css_links.trunk.php'; | |
require_once __DIR__ . '/_wp_normalize_relative_css_links.patch.php'; | |
/** | |
* @BeforeMethods("setUp") | |
* @Revs(100) | |
* @Iterations(5) |
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 | |
/** | |
* PWA Cache Pre-Activation Resources | |
* | |
* @package PWA | |
* @author Weston Ruter | |
* @link https://gist.github.com/westonruter/3beda9d304c02712cbb0f01ba06aa5b2 | |
* @license GPL-2.0-or-later | |
* @copyright 2019 Google Inc. | |
* |
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 | |
if [ ! -e composer.json ]; then | |
echo "Run script from package root." | |
exit 1 | |
fi | |
# "Composer 2.3.0 dropped support for PHP <7.2.5 and you are running 5.6.40, please upgrade PHP or use Composer 2.2 LTS…" | |
docker run -it --rm --name composer-install -v "$PWD":/app -w /app php:5.6-cli-alpine sh -c " | |
wget -O /tmp/composer.phar https://getcomposer.org/download/latest-2.2.x/composer.phar \ |