Skip to content

Instantly share code, notes, and snippets.

View brianlayman's full-sized avatar

Brian Layman brianlayman

View GitHub Profile
<?php
/**
* Function remove_action_by_class
* Used to remove notices and nags or other class actions added with class instances (unable to remove with remove_action)
*
* @param $hook_name
* @param $class_and_function_list
* @param int $priority
@GreenFootballs
GreenFootballs / amazon_regex.md
Last active August 31, 2022 11:12
A PHP regular expression to match Amazon links and extract the ASIN identifier
~
    (?:(smile\.|www\.))?    # optionally starts with smile. or www.
    ama?zo?n\.              # also allow shortened amzn.com URLs
    (?:
        com                 # match all Amazon domains
        |
        ca
        |
        co\.uk
@PaulKinlan
PaulKinlan / criticalcss-bookmarklet-devtool-snippet.js
Last active April 2, 2024 02:45
CriticalCSS Bookmarklet and Devtool Snippet.js
(function() {
var CSSCriticalPath = function(w, d, opts) {
var opt = opts || {};
var css = {};
var pushCSS = function(r) {
if(!!css[r.selectorText] === false) css[r.selectorText] = {};
var styles = r.style.cssText.split(/;(?![A-Za-z0-9])/);
for(var i = 0; i < styles.length; i++) {
if(!!styles[i] === false) continue;
var pair = styles[i].split(": ");