Skip to content

Instantly share code, notes, and snippets.

@pedddro
pedddro / gist:2579a0de4e63abdffd77ee485e4b7e8d
Created October 29, 2025 16:13
Check if a page has a screenshot on the Wayback Machine Bookmarklet
javascript: (function () {
const currentOrigin = window.location.origin;
if (currentOrigin === "https://web.archive.org") {
const currentPath = window.location.pathname;
const currentPathEncoded = encodeURIComponent(currentPath);
const parts = currentPath.split("/");
parts[2] = parts[2].replace("", "") + "/http://web.archive.org/screenshot";
window.location.href = currentOrigin + parts.join("/");
}
})();
@pedddro
pedddro / gist:d650864567faf56d9370aa1fee6e6a2d
Created February 25, 2025 13:16
Visualize Core Web Vitals 75th percentile(Google Search threshold)
javascript:(function(){ window.open('https://treo.sh/sitespeed/%27 + encodeURIComponent(window.location.host) + '?metrics=rtt-p75-75-275%2Cttfb-p75-800-1800%2Cfcp-p75-1800-3000%2Clcp-p75-2500-4000%2Cr-p75-200-500%2Ccls-p75-10-25%27)} )();
@pedddro
pedddro / gist:5a33b86a431ad15daeebd7241a071738
Created February 25, 2025 13:16
Visualize Core Web Vitals 90th percentile shortcut
javascript:(function(){ window.open('https://treo.sh/sitespeed/%27 + encodeURIComponent(window.location.host) + '?metrics=rtt-p90-75-275%2Cttfb-p90-800-1800%2Cfcp-p90-1800-3000%2Clcp-p90-2500-4000%2Cr-p90-200-500%2Ccls-p90-10-25%27)} )();
@pedddro
pedddro / gist:5d721ebf64c4f0b9b34b154a4dcd0931
Created July 23, 2024 20:01
simple static repro html code block
<!-- wp:group {"style":{"background":{"backgroundImage":{"url":"https://soakjeans.s4-tastewp.com/wp-content/uploads/2024/07/mesh-50.webp","id":9,"source":"file","title":"mesh-50"},"backgroundPosition":"50% 0"}},"layout":{"type":"constrained"}} -->
<div class="wp-block-group"><!-- wp:paragraph -->
<p>This group block should render with a mesh background by Simply static</p>
<!-- /wp:paragraph --></div>
<!-- /wp:group -->
<!-- wp:cover {"url":"https://soakjeans.s4-tastewp.com/wp-content/uploads/2024/07/mesh-50.webp","id":9,"dimRatio":50,"customOverlayColor":"#d9bfd6","isDark":false,"layout":{"type":"constrained"}} -->
<div class="wp-block-cover is-light"><span aria-hidden="true" class="wp-block-cover__background has-background-dim" style="background-color:#d9bfd6"></span><img class="wp-block-cover__image-background wp-image-9" alt="" src="https://soakjeans.s4-tastewp.com/wp-content/uploads/2024/07/mesh-50.webp" data-object-fit="cover"/><div class="wp-block-cover__inner-container"><!-- wp:paragraph {"align":"ce
@pedddro
pedddro / unlighthouse.config.ts
Last active September 17, 2023 15:38
Pagespeed Desktop recipe for Unlighthouse
// from https://github.com/harlan-zw/unlighthouse/issues/149
const DESKTOP_EMULATION_METRICS = {
mobile: false,
width: 1350,
height: 940,
deviceScaleFactor: 1,
disabled: false,
};
export default {
extends: 'lighthouse:default',
@pedddro
pedddro / unlighthouse.config.ts
Last active September 17, 2023 15:39
Unlighthouse mobile SEO recipe (mobile-friendly)
export default {
site: '#',
lighthouseOptions: {
onlyCategories: ['seo']
},
// puppeteerClusterOptions: {
// // only run 2 worker at a time
// maxConcurrency: 2
// },
scanner: {
<!-- place in your footer.php to simulate the crisp chat loading // z-index: 1000000; to appear on top of cookies-->
<p id="fake-crisp-chat" style="margin-bottom: 0;">
<abbr title="Crisp Chat will load shortly, Click again to open it"><img id="fake-crisp-chat-img" src="/wp-content/uploads/2023/07/fake_crisp_chat.png" alt="Fake chat" fetchpriority="high"></abbr>
</p>
<style>
#fake-crisp-chat {
position: fixed;
bottom: 1.3em;
right: 1em;
z-index: 1000000;
@pedddro
pedddro / unlighthouse.config.ts
Last active June 15, 2023 21:53
Best UNLH config for accurate CWV metrics v1
export default {
site: '#',
lighthouseOptions: {
onlyCategories: ['performance']
},
puppeteerClusterOptions: {
// only run 2 worker at a time
maxConcurrency: 2
},
scanner: {
@pedddro
pedddro / gist:1c472b9564ebf10fbaf1fcb3a0e7dfc7
Created March 22, 2023 14:47
Google bard code for a wordpress plugin that deletes media older than 1 year old
<?php
define( 'PLUGIN_NAME', 'Delete Old Media' );
define( 'PLUGIN_VERSION', '1.0' );
define( 'PLUGIN_FILE', __FILE__ );
// Define the plugin settings
$settings = array(
'delete_old_media_after' => 365, // The number of days to keep images before deleting them
'log_deleted_media' => true, // Whether to log the full URL of all deleted media files
0412dda9dceab1ede1dbe8a010aa80b16de0ea8ee6093012d5a3c46c01f78e8feb5b2119240070eb31689a82f75660a1149193b94bdb4d3c07231ea3c4538c4d23;romanornr