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 / terminus-org-primary-domain.sh
Last active September 23, 2022 21:28
Check is sites in an organization have a primary domain assigned.
#!/bin/bash
# Example
# ./terminus-org-primary-domain.sh <ORG_ID>
# Exit on error
set -e
ORG_ID=$1
TEMP_FILE=$(echo "/tmp/$ORG_ID-primary-domains.csv")
<?php
/**
* @file
* Contains \Project\composer\ComposerPrivateAuth.
*/
namespace Project\composer;
use Composer\Script\Event;
@kyletaylored
kyletaylored / multisite-lando-config.yml
Last active July 26, 2022 15:12
Lando WordPress Network Site / Multisite (WPMS)
# Using the pantheon recipe / wordpress_network framework, we add a config to the
# appserver_nginx service to use our own server and vhost files. Copy the files lando
# uses and on the wordpress_network.conf.tpl and added wp/ to the rewrite
# rules so lando knows where our WP files live within our Bedrock setup.
appserver_nginx:
type: nginx
ssl: true
config:
server: 'private/config/lando/nginx.conf.tpl'
@kyletaylored
kyletaylored / get_creds.php
Created September 30, 2021 19:52
Get Pantheon public database credentials for external integration
<?php
/**
* This is a script to retrieve DB credentials for database connections
*
*/
/**
* Check IP address function
*/
<?php
$myFile = new SplFileObject("data.txt");
$ips = [];
$count=0;
while (!$myFile->eof()) {
$ip = trim($myFile->fgets());
// Skip if IPv6
@kyletaylored
kyletaylored / wpml-cli.php
Created March 23, 2022 21:25
Fetch WPML languages through WP CLI
<?php
/*
Plugin Name: WPML CLI
Plugin URI: https://pantheon.io
Description: WPML CLI demo commands
Author: Kyle Taylor
Version: 1.0.0
Author URI: https://github.com/kyletaylored
*/
@kyletaylored
kyletaylored / wds-hello-world.php
Created March 23, 2022 21:03 — forked from Oceas/wds-hello-world.php
WDS WP-CLI 101 Complete
<?php
/*
Plugin Name: WDS Hello World
Plugin URI: https://webdevstudios.com/
Description: Teaching the basics of WP-CLI
Author: Web Dev Studios
Version: 1.0.0
Author URI: https://webdevstudios.com/
*/
class WDS_CLI {
@kyletaylored
kyletaylored / quotaguard.php
Last active January 26, 2022 21:33
An example usage of QuotaGuard in PHP
<?php
// Punch through the Pantheon edge cache. This is not required
// when building a full Drupal site, just so we don't worry about testing.
setcookie('NO_CACHE', '1');
/**
* Proxy function.
*
* @return void
@kyletaylored
kyletaylored / example-shell.txt
Last active January 5, 2022 17:55
Audit git diffs against upstream sites.
$ ./git-auditor.sh 443d26c3-6b6b-4cd4-b102-decb061e8261
--- Upstream Information ---
Name: slac-poc-upstream
Organization: Pantheon Sales Demo
Git: https://github.com/Pantheon-SE/slac-poc-upstream.git
Cloning the upstream...
Cloning into 'slac-poc-upstream'...
remote: Enumerating objects: 12092, done.
remote: Counting objects: 100% (12092/12092), done.
@kyletaylored
kyletaylored / lift-listener.js
Last active November 18, 2021 15:39
Acquia Lift Experience Builder: Removing dual wrappers when replacing content with CSS selector
window.addEventListener('acquiaLiftContentAvailable', function(event) {
function unwrap(wrapper) {
// place childNodes in document fragment
var docFrag = document.createDocumentFragment();
while (wrapper.firstChild) {
var child = wrapper.removeChild(wrapper.firstChild);
docFrag.appendChild(child);
}
// replace wrapper with document fragment