Skip to content

Instantly share code, notes, and snippets.

View kyletaylored's full-sized avatar
🍝
unfurling wet spaghetti

Kyle Taylor kyletaylored

🍝
unfurling wet spaghetti
View GitHub Profile
@kyletaylored
kyletaylored / nginx-log-parser.php
Created October 2, 2023 17:51
Nginx Log Parser WordPress Plugin
<?php
/**
* Plugin Name: Nginx Log Parser
* Description: Parses Nginx logs for query parameter insights.
* Version: 1.0
* Author: Kyle Taylor
* Author URI: https://pantheon.io
*/
if (!class_exists('WP_List_Table')) {
@kyletaylored
kyletaylored / pantheon-sql-perf.php
Last active September 26, 2023 22:30
Fix SQL_CALC_FOUND_ROWS performance degradation on WordPress, fix database indexes and primary keys.
<?php
/**
* Plugin Name: WordPress SQL Performance
* Plugin URI: https://www.pantheon.io
* Description: Fix SQL_CALC_FOUND_ROWS performance degradation.
* Author: Kyle Taylor, Pantheon
* Version: 1.0
* License: GPL2
* Credit: https://wpartisan.me/tutorials/wordpress-database-queries-speed-sql_calc_found_rows
@kyletaylored
kyletaylored / bfi_thumb.php
Created September 26, 2023 16:29
Fix bfi_thumb.php for Pantheon directories
<?php
// Create the upload subdirectory, this is where
// we store all our generated images
if ( defined( 'BFITHUMB_UPLOAD_DIR' ) ) {
$upload_dir .= "/" . BFITHUMB_UPLOAD_DIR;
$upload_url .= "/" . BFITHUMB_UPLOAD_DIR;
} else {
$upload_dir .= "/bfi_thumb";
$upload_url .= "/bfi_thumb";
@kyletaylored
kyletaylored / .gitignore
Last active August 9, 2023 15:27
IP analysis script
node_modules
*.csv
package-lock.json
@kyletaylored
kyletaylored / .puppeteerrc.cjs
Created June 29, 2023 19:53
Install Chrome into Pantheon Appserver using PHP and NodeJS
const { join } = require("path");
/**
* @type {import("puppeteer").Configuration}
*/
module.exports = {
// Changes the cache location for Puppeteer.
cacheDirectory: join(__dirname, ".cache", "puppeteer"),
};
@kyletaylored
kyletaylored / blue-green.sh
Created January 4, 2023 23:14
Blue Green deployment and synchronization script.
#!/bin/bash -e
# ____ _ ______
# | __ )| |_ _ ___ / / ___|_ __ ___ ___ _ __
# | _ \| | | | |/ _ \ / / | _| '__/ _ \/ _ \ '_ \
# | |_) | | |_| | __// /| |_| | | | __/ __/ | | |
# |____/|_|\__,_|\___/_/ \____|_| \___|\___|_| |_|
#
# Blue / Green deployment script for Pantheon sites using Terminus.
#
@kyletaylored
kyletaylored / cachetool-check.sh
Created May 17, 2023 19:20
A one-liner for checking opcache information using cachetool and WP CLI or Drush.
(wp|drush) eval '$cachetool=sys_get_temp_dir()."/cachetool.phar";$old="https://gordalina.github.io/cachetool/downloads/cachetool-3.2.2.phar";$new="https://github.com/gordalina/cachetool/releases/download/8.5.0/cachetool.phar";$url=(version_compare(phpversion(), "8") < 0) ? $old : $new;file_put_contents($cachetool, file_get_contents($url));chmod($cachetool, 0755);echo shell_exec("php $cachetool opcache:status --fcgi=/shared-run/php-fpm.sock");unlink($cachetool);'
@kyletaylored
kyletaylored / composer.json
Last active April 19, 2023 14:53
How to integrate Monolog with New Relic in Drupal 9
{
"require": {
"drupal/monolog": "^2.2",
"newrelic/monolog-enricher": "^2.0"
}
}
@kyletaylored
kyletaylored / .lando.yml
Created March 4, 2023 01:59
Lando example config with PHP override and multiple databases
name: example
recipe: pantheon
config:
framework: drupal8
site: example
id: <SITE_UUID>
xdebug: true
php: 8.1
index: false
edge: false
@kyletaylored
kyletaylored / .gitignore
Created March 4, 2022 16:08
Add Node build capabilities to composer.json
# Ignore asset build path in theme
# --------------------------------
/web/themes/custom/radix_subtheme/build/