Skip to content

Instantly share code, notes, and snippets.

@AndrewJDawes
AndrewJDawes / README.md
Created April 7, 2026 16:16
Pretext (@chenglou/pretext): H1 font-size/class from measured wraps (browser example)

Pretext: pick H1 font-size or class from measured wraps (browser)

Browser-side example using @chenglou/pretext to pick an H1 font-size (or a CSS class) from measured wraps at a few container widths, instead of a raw character count.

Install

npm install @chenglou/pretext
@AndrewJDawes
AndrewJDawes / webfx-plugin-wp-rocket-disable-automatic-lazy-rendering.php
Last active March 14, 2025 19:06
WebFX Plugin - WP Rocket Disable Automatic Lazy Rendering #WPRocket #LazyLoad
<?php
/**
* Plugin Name: WebFX Plugin - WP Rocket Disable Automatic Lazy Rendering
* Description: Disables WP Rocket's automatic lazy rendering to prevent conflicts with custom lazy load implementations.
* Version: 1.0.0
*/
/*
@AndrewJDawes
AndrewJDawes / index.js
Last active August 28, 2023 23:38
Save React component as state
import "./index.css";
import { useState } from "react";
import ColumnHeader from "../columnHeader";
import ColumnHeaderFilter from "../columnHeaderFilter";
import FilterModal from "../filterModal";
import FilterFormFeatureText from "../filterForms/text";
// re: https://codesandbox.io/s/scrollable-sticky-panes-t0x86?from-embed=&file=/index.html:448-1358
function TheGrid({ headerRowHeight, leadingColumnWidth, font, features, dimensions, dimensionsFeatures }) {
const [modalContent, setModalContent] = useState(null);
@AndrewJDawes
AndrewJDawes / webfx-plugin-wpml-workaround-sync-sticky.php
Last active June 29, 2023 21:52
Plugin workaround for WPML Synchonize Sticky Flag feature #WPML
<?php
/**
* Plugin Name: WebFX - WPML - Workaround - Fix Synchronize Sticky Flag
* Plugin URI: https://www.webfx.com/
* Description: Fix WPML's Synchronize Sticky Flag setting to work when a post type is set to Translatable - use translation if available or fallback to default language.
* Version: 0.0.1
*/
class WebFX_WPML_Workaround_Fix_Synchronize_Sticky_Flag
@AndrewJDawes
AndrewJDawes / class-fx-gatorco-import-videos.php
Last active March 28, 2023 19:53
Use WP CLI to format and import CSV files #WP_CLI #WordPress #CLI #CSV #Import
<?php
/**
* Class for importing YouTube video links for products via WP CLI
*/
final class FX_Gatorco_Import_Videos
{
private static $instance;
public static function get_instance()
{
if (!(self::$instance instanceof self)) {
@AndrewJDawes
AndrewJDawes / system_report.sh
Last active February 2, 2023 15:31
system_report.sh #Bash
#!/usr/bin/env bash
# Commonly Supported Style Codes
# https://prnt.sc/v-GFBk1q0_TL
# Variables can be bound for style codes
style_fg_black=30
style_fg_red=31
style_fg_green=32
style_fg_yellow=33
@AndrewJDawes
AndrewJDawes / .gitignore
Created January 20, 2023 21:44
Local by Flywheel and WP Staging Pro .gitignore #git #Local #Flywheel #WP_Staging_Pro
# Ignore everything
/**
# Don't ignore .gitignore
!/.gitignore
# Don't ignore wp-content
!/wp-content/
# Ignore everything beneath wp-content
@AndrewJDawes
AndrewJDawes / webfx-plugin-jetpack-lla-security.php
Last active January 26, 2023 02:07
Jetpack whitelist IP addresses using the Limit Login Attempts plugin #Jetpack #Limit_Login_Attempts #whitelist #Firewall
<?php
/*
* Plugin Name: WebFX Plugin Jetpack and Limit Login Attempts Security Integration
* Version: 0.0.1
*/
defined('ABSPATH') || exit;
if (!function_exists('webfx_jetpack_lla_debug_log')) {
/**
* Debug log
@AndrewJDawes
AndrewJDawes / styled_text.sh
Created January 15, 2023 16:13
Print styled text to terminal emulator #shell
#!/usr/bin/env bash
# Commonly Supported Style Codes
# https://prnt.sc/v-GFBk1q0_TL
# Variables can be bound for style codes
style_fg_yellow=33
style_bg_bright_black=100
style_bg_black=40
style_bright=1
@AndrewJDawes
AndrewJDawes / .gitignore
Created December 30, 2022 18:35
Ignore all WordPress files except plugins, mu-plugins, and themes #git #WordPress
# Ignore everything
/**
# Don't ignore .gitignore
!/.gitignore
# Don't ignore wp-content
!/wp-content/
# Ignore everything beneath wp-content