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 | |
/** | |
* Disable password reset | |
* | |
* @wordpress-plugin | |
* Plugin Name: Disable password reset. | |
* Description: Disable password reset. | |
* Plugin URI: | |
* Version: 1.0.0 | |
* Author: Adam Silverstein, Google |
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
/* | |
* Yielding method using scheduler.yield, falling back to setTimeout: | |
*/ | |
async function yieldToMain() { | |
if('scheduler' in window && 'yield' in scheduler) { | |
return await scheduler.yield(); | |
} | |
return new Promise(resolve => { | |
setTimeout(resolve, 0); |
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
SELECT | |
* | |
FROM( | |
SELECT | |
JSON_VALUE(third_party, '$.entity') as entity, | |
CAST(APPROX_QUANTILES(CAST(JSON_QUERY(third_party, '$.blockingTime') AS FLOAT64), 100)[offset(75)] as INT64) as p75_blockingTime, | |
COUNT(page) as usage | |
FROM | |
`httparchive.all.pages`, | |
UNNEST(technologies) as technologies, |
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
%%bigquery oembeds | |
WITH | |
WPEmbeds AS ( | |
SELECT | |
url, | |
JSON_EXTRACT(payload, '$._cms.wordpress.has_embed_block') AS has_embed_block, | |
CAST( JSON_EXTRACT(payload, '$._cms.wordpress.embed_block_count.total') AS FLOAT64 ) AS embed_block_count_total, | |
JSON_EXTRACT_ARRAY(payload, '$._cms.wordpress.embed_block_count.total_by_type') AS embed_block_count_total_by_type, | |
FROM `httparchive.pages.2023_10_01_*` |
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
%%bigquery bytype | |
WITH | |
embed_data AS ( | |
SELECT | |
url, | |
JSON_EXTRACT(payload, '$._cms.wordpress.has_embed_block') AS has_embed_block, | |
CAST(JSON_EXTRACT(payload, '$._cms.wordpress.embed_block_count.total') AS FLOAT64) | |
AS embed_block_count_total, | |
JSON_EXTRACT(payload, '$._cms.wordpress.embed_block_count.total_by_type') AS embeds, | |
FROM `httparchive.pages.2023_10_01_desktop` |
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 | |
/** | |
* Enable revisions for product_price | |
*/ | |
function enable_revisions_for_product_price_field( $revisioned_keys ) { | |
if ( ! in_array( 'product_price', $revisioned_keys ) ) { | |
$revisioned_keys[] = 'product_price'; | |
} | |
return $revisioned_keys; | |
} |
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 | |
/** | |
* Recursively add the defer strategy to a script and all its dependencies. | |
* | |
* @param string $handle The script handle. | |
* @return void | |
*/ | |
function recursively_add_defer_strategy( $handle ) { | |
wp_script_add_data( $handle, 'strategy', 'defer' ); |
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 | |
/** | |
* Add lazy loading to oEmbed iframes. | |
* | |
* @wordpress-plugin | |
* Plugin Name: Lazy Load oEmbeds. | |
* Description: Add lazy loading to oEmbed iframes. | |
* Plugin URI: | |
* Version: 1.0.0 | |
* Author: Adam Silverstein, Google |
NewerOlder