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 |
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
CREATE TEMP FUNCTION getFeatures(payload STRING) | |
RETURNS STRING | |
LANGUAGE js | |
AS ''' | |
try { | |
var $ = JSON.parse(payload); | |
var almanac = JSON.parse($._almanac); | |
var generators = almanac['meta-nodes'].nodes.find(node => node.name == 'generator' && node.content.startsWith("Elementor")); | |
if ( generators.length == 0 ) { | |
return ""; |
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
CREATE TEMP FUNCTION IS_GOOD(good FLOAT64, needs_improvement FLOAT64, poor FLOAT64) | |
RETURNS BOOL | |
AS ( | |
good / (good + needs_improvement + poor) >= 0.75 | |
); | |
CREATE TEMP FUNCTION IS_NON_ZERO(good FLOAT64, needs_improvement FLOAT64, poor FLOAT64) | |
RETURNS BOOL | |
AS ( | |
good + needs_improvement + poor > 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
class Custom_REST_Users_Controller extends WP_REST_Users_Controller { | |
/** | |
* Registers the routes for the controller. | |
*/ | |
public function register_routes() { | |
parent::register_routes(); | |
add_filter( 'rest_user_query', array( $this, 'filter_user_query_by_meta_fields' ), 10, 2 ); | |
} |
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
#standardSQL | |
# Breakdown of scripts using Async, Defer, Module or NoModule attributes. Also breakdown of inline vs external scripts | |
CREATE TEMPORARY FUNCTION getScripts(payload STRING) | |
RETURNS | |
STRUCT< | |
total INT64, | |
inline INT64, | |
src INT64, | |
async INT64, |
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
# Breakdown of scripts using Async, Defer, Module or NoModule attributes. Also breakdown of inline vs external scripts | |
CREATE TEMPORARY FUNCTION getScripts(payload STRING) | |
RETURNS | |
STRUCT< | |
total INT64, | |
inline INT64, | |
src INT64, | |
async INT64, | |
defer INT64, | |
async_and_defer INT64, |
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
CREATE TEMP FUNCTION IS_GOOD(good FLOAT64, needs_improvement FLOAT64, poor FLOAT64) RETURNS BOOL AS ( | |
good / (good + needs_improvement + poor) >= 0.75 | |
); | |
CREATE TEMP FUNCTION IS_NON_ZERO(good FLOAT64, needs_improvement FLOAT64, poor FLOAT64) RETURNS BOOL AS ( | |
good + needs_improvement + poor > 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
#standardSQL | |
# Breakdown of scripts using Async, Defer, Module or NoModule attributes. Also breakdown of inline vs external scripts | |
CREATE TEMPORARY FUNCTION getScripts(payload STRING) | |
RETURNS | |
STRUCT< | |
total INT64, | |
inline INT64, | |
src INT64, | |
async INT64, | |
defer INT64, |
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
WITH wordpress AS ( | |
SELECT DISTINCT | |
url | |
FROM | |
`httparchive.technologies.2022_09_01_*` | |
WHERE | |
app = 'WordPress' | |
) | |
SELECT |