Skip to content

Instantly share code, notes, and snippets.

Avatar

Weston Ruter westonruter

View GitHub Profile
View lando.sh
#!/bin/bash
cd $( dirname "$0" )/..
set -e
set -x
if [ -z "$1" ]; then
command="start"
else
View amp-fx-blocks.php
<?php
/**
* AMP FX Blocks plugin bootstrap.
*
* @package Google\AMP_FX_Blocks
* @author Weston Ruter, Google
* @license GPL-2.0-or-later
* @copyright 2021 Google Inc.
*
* @wordpress-plugin
View background-image-svg-data-url.css
#try-stylesheet-containing-closing-style-tag {
background-color: red;
}
#try-stylesheet-containing-closing-style-tag {
background-image: url( "data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' version='1.1' viewBox='0 0 30 30' width='30' height='30'><title>AMP</title><defs><style>.circle{fill:white}.overlay{fill:blue;}</style></defs><g fill='none' fill-rule='evenodd'><path class='circle' d='M0 15c0 8.284 6.716 15 15 15 8.285 0 15-6.716 15-15 0-8.284-6.715-15-15-15C6.716 0 0 6.716 0 15z'/><path class='overlay' fill-rule='nonzero' d='M13.85 24.098h-1.14l1.128-6.823-3.49.005h-.05a.57.57 0 0 1-.568-.569c0-.135.125-.363.125-.363l6.272-10.46 1.16.005-1.156 6.834 3.508-.004h.056c.314 0 .569.254.569.568 0 .128-.05.24-.121.335L13.85 24.098zM15 0C6.716 0 0 6.716 0 15c0 8.284 6.716 15 15 15 8.285 0 15-6.716 15-15 0-8.284-6.715-15-15-15z'/></g></svg>" );
background-repeat: no-repeat;
background-color: lime;
background-position: bottom left;
background-size: 50px 50px;
View amp-cover-block-fix.php
<?php
/**
* AMP Cover Block Fix plugin bootstrap.
*
* @package Google\AMP_Cover_Block_Fix
* @author Weston Ruter, Google
* @license GPL-2.0-or-later
* @copyright 2021 Google Inc.
*
* @wordpress-plugin
View amp-domain-checker.php
<?php
/**
* Check domains for the status of AMP on the homepage.
*
* The input file needs to have one domain per line.
*
* USAGE:
*
* wp eval-file amp-domain-checker.php domains.txt
* cat domains.txt | wp eval-file amp-domain-checker.php -
@westonruter
westonruter / amp-responsive-image-preload-link-srcset-opt-in.php
Last active Jan 31, 2021
Enable preload links for responsive hero images which have srcset and sizes attributes. This is disabled by default because only Chrome supports imagesrcset and imagesizes on preload links. This eliminates the Optimizer from raising this notice: CannotPreloadImage: Not preloading the hero image because of the presence of a srcset attribute…
View amp-responsive-image-preload-link-srcset-opt-in.php
View amp-mobile-server-side-redirection.php
<?php
/**
* AMP Mobile Server-Side Redirection plugin bootstrap.
*
* @package Google\AMP_Mobile_Server_Side_Redirection
* @author Weston Ruter, Google
* @license GPL-2.0-or-later
* @copyright 2021 Google Inc.
*
* @wordpress-plugin
View jetpack-amp-contact-form-submission-fix.php
<?php
/**
* Jetpack AMP Contact Form Submission Fix plugin bootstrap.
*
* @package Google\Jetpack_AMP_Contact_Form_Submission_Fix
* @author Weston Ruter, Google
* @license GPL-2.0-or-later
* @copyright 2021 Google Inc.
*
* @wordpress-plugin
View Sanitizer.php
<?php
/**
* Sanitizer file.
*
* @package Google\AMP_Auto_Lightbox_Disable
*/
namespace Google\AMP_Auto_Lightbox_Disable;
use AMP_Base_Sanitizer;
View amp-update-supported-post-types-cli-command.php
<?php
/**
* AMP Update Supported Post Types WP-CLI Command
*
* @package Google\AMP_Update_Supported_Post_Types_CLI_Command
* @author Weston Ruter, Google
* @license GPL-2.0-or-later
* @copyright 2021 Google Inc.
*
* @wordpress-plugin