Skip to content

Instantly share code, notes, and snippets.

View sarahg's full-sized avatar
🏂

Sarah German sarahg

🏂
View GitHub Profile
@jenkoian
jenkoian / wp-plugin-mutation-test.sh
Created December 23, 2021 17:06
Small bash script to do some _very_ basic plugin mutation testing against a website. i.e. check the site doesn't fall over if a random plugin is deactivated.
#!/usr/bin/env bash
URL_TO_CHECK=${1}
if [ -z "$URL_TO_CHECK" ]; then
echo 'Please supply a URL'
exit 1;
fi
WP="wp"
@twfahey1
twfahey1 / example-wp.sh
Last active August 4, 2022 11:04
Pantheon - run php-script (php eval alternative) via terminus against a site
cat hello.php | terminus remote:wp ${SITE}.${ENV} -- eval-file -
@rachelwhitton
rachelwhitton / audit-cname-values.sh
Created December 9, 2019 23:18
Given a txt file of CNAME values, audit for values that resolve to Pantheon
#!/bin/bash
PANTHEON_GLOBAL_CDN=(23.185.0.1 23.185.0.2 23.185.0.3 23.185.0.4)
while IFS='' read -r l || [ -n "$l" ]; do
IP=`dig +short $l | grep '^[.0-9]*$'`
if [[ "${PANTHEON_GLOBAL_CDN[@]}" =~ $IP ]];
then
echo "yes '$l'" >> CNAMEpointsToPantheon.txt ;
else
echo "no";
fi
<?php
namespace Drupal\my_module\Compiler;
use Drupal\Component\Utility\Crypt;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
/**
* Overrides the original hash builder to not use the file modified time
@geraldvillorente
geraldvillorente / wp-debug.md
Last active March 7, 2019 16:13
Managing Wordpress debug.log on Pantheon

Wordpress has its own debugging system that Pantheon customers can leverage. Below is the setup that should be able to work regardless of environment connection mode.

Place this code on wp-config.php:

if (defined('PANTHEON_ENVIRONMENT')) {
    // Wordpress debug settings in Development and Test environments.
    if (!in_array(PANTHEON_ENVIRONMENT, array('live'))) {
      // Debugging enabled.
      if (!defined( 'WP_DEBUG' )) {
 define( 'WP_DEBUG', true );
@greg-1-anderson
greg-1-anderson / lock-all-environments
Last active November 12, 2021 20:52
Lock all of the environments for the given site, save for the live environment
#!/bin/bash
SITE=$1
USER=${2-demo}
PASSWORD=${3-secretsecret}
ALL_ENVS="$(terminus env:list $SITE --field=id | grep -v live)"
for ENV in $ALL_ENVS ; do
is_locked="$(terminus lock:info "$SITE.$ENV" --field=locked)"
@DarraghB1992
DarraghB1992 / README.md
Last active January 31, 2024 23:23
Exporting Saved Replies from Intercom into a CSV file
@crittermike
crittermike / disable_aggregation.md
Last active February 14, 2022 12:17
Disabling CSS/JS aggregation via Drush in Drupal 7 and Drupal 8

Drupal 7

drush vset preprocess_css 0 --yes
drush vset preprocess_js 0 --yes

Drupal 8

@rikki-iki
rikki-iki / drupal-theme-suggestions.theme
Last active February 7, 2023 01:47
Useful theme suggestions (may use deprecated php)
<?php
use Drupal\block\Entity\Block;
use Drupal\block_content\BlockContentInterface;
/**
* Implements hook_theme_suggestions_HOOK_alter().
*/
function HOOK_theme_suggestions_page_alter(array &$hooks, array &$vars): void {
$constrained = [
@AlexSkrypnyk
AlexSkrypnyk / mymodule.css
Last active April 17, 2024 08:37
Drupal 'add more' and 'remove single' AJAX buttons on multi value custom field using FormAPI
input.form-submit.button-small {
padding: 4px 8px;
font-weight: bold;
}
.container-inline input.form-submit.button-small + .ajax-progress.ajax-progress-throbber .throbber {
position: absolute;
left: 19px;
margin-top: 7px;
}