Skip to content

Instantly share code, notes, and snippets.

View slattery's full-sized avatar

Mike Slattery slattery

View GitHub Profile
@slattery
slattery / admin_toolbar_3_5_zero_and_options.patch
Last active October 21, 2024 21:14
admin_toolbar_3_5_zero_and_options.patch
commit 29aaf867238f1fe8428c116de30bf50fbe24fe36
Author: slattery
Date: Mon Oct 21 17:12:27 2024 -0400
rolling two patches in one
diff --git a/admin_toolbar_tools/src/Plugin/Derivative/ExtraLinks.php b/admin_toolbar_tools/src/Plugin/Derivative/ExtraLinks.php
index 69f4f41..e06d1c7 100644
--- a/admin_toolbar_tools/src/Plugin/Derivative/ExtraLinks.php
+++ b/admin_toolbar_tools/src/Plugin/Derivative/ExtraLinks.php
@slattery
slattery / clipboardjs-tooltip-collision.patch
Last active June 11, 2024 18:24
clipboardjs-tooltip-collision.patch
diff --git a/js/clipboard.js b/js/clipboard.js
index 05513e94c9a5c5207518d93ffd307f2045a43572..608a66bf18d5365f56cfb9f6f313f0640ca7eaf4 100644
--- a/js/clipboard.js
+++ b/js/clipboard.js
@@ -34,7 +34,7 @@ window.ClipboardJS = window.ClipboardJS || Clipboard;
}
// Display as tooltip.
else if (alertStyle === 'tooltip') {
- let $tooltip = $('.tooltip', e.trigger);
+ let $tooltip = $('.clipboardjs-tooltip', e.trigger);
@slattery
slattery / d10_config_importer_entitycheck_b4_delete.patch
Last active May 7, 2024 16:52
d10_config_importer_entitycheck_b4_delete.patch
diff --git a/core/lib/Drupal/Core/Config/ConfigImporter.php b/core/lib/Drupal/Core/Config/ConfigImporter.php
index 18f7a0c..b0c60d7 100644
--- a/ConfigImporter.php
+++ b/ConfigImporter.php
@@ -10,6 +10,7 @@ use Drupal\Core\Extension\ThemeExtensionList;
use Drupal\Core\Extension\ThemeHandlerInterface;
use Drupal\Core\Config\Entity\ImportableEntityStorageInterface;
use Drupal\Core\DependencyInjection\DependencySerializationTrait;
+use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Entity\EntityStorageException;
@slattery
slattery / ckeditor_link_styles_decorator_update_5_v29_1.patch
Created December 5, 2023 05:47
ckeditor_link_styles_decorator_update_5_v29_1.patch
@slattery
slattery / README.md
Last active November 7, 2023 17:39
compare two lando template dirs

Diff lando template dirs

Sometimes you want to know how two files in two sites differ.

Setup

Place the diffwith.sh file somewhere you can get at it, and either

  • chmod 755 path/to/diffwith.sh to make it executable
  • just know you'll type bash path/to/diffwith.sh name-of-comparedir each time, which is legit too.
@slattery
slattery / WOS_000926394000002.ris
Created November 3, 2023 22:30
Single RIS record with plus sign for EP
TY - JOUR
AU - Uribe, MD
AU - Coe, MT
AU - Castanho, ADA
AU - Macedo, MN
AU - Valle, D
AU - Brando, PM
TI - Net loss of biomass predicted for tropical biomes in a changing climate
T2 - NATURE CLIMATE CHANGE
AB - Tropical ecosystems store over half of the world's aboveground live carbon as biomass, and water availability plays a key role in its distribution. Although precipitation and temperature are shifting across the tropics, their effect on biomass and carbon storage remains uncertain. Here we use empirical relationships between climate and aboveground biomass content to show that the contraction of humid regions, and expansion of those with intense dry periods, results in substantial carbon loss from the neotropics. Under a low emission scenario (Representative Concentration Pathway 4.5) this could cause a net reduction of aboveground live carbon of -14.4-23.9 PgC (6.8-12%) from 1950-2100. Under a high emissions scenario (Representative Concentration Pathway 8.5) net carbon losses could double a
@slattery
slattery / bibcite-ris-encoder-nondigitfix-20231103-01.patch
Created November 3, 2023 22:24
bibcite-ris-encoder-nondigitfix-20231103-01.patch
diff --git a/modules/bibcite_ris/src/Encoder/RISEncoder.php b/modules/bibcite_ris/src/Encoder/RISEncoder.php
index 78cc087..f5af92d 100644
--- a/modules/bibcite_ris/src/Encoder/RISEncoder.php
+++ b/modules/bibcite_ris/src/Encoder/RISEncoder.php
@@ -60,7 +60,7 @@ class RISEncoder implements EncoderInterface, DecoderInterface {
$record['EP'] = (array) $record['EP'];
}
$max_sp = array_key_exists('SP', $record) ? max($record['SP']) : NULL;
- $max_ep = array_key_exists('EP', $record) ? max($record['EP']) : 0;
+ $max_ep = array_key_exists('EP', $record) && is_int($record['EP']) ? max($record['EP']) : 0;
@slattery
slattery / bibcite-ris-ris-entity-bibtex-20231103-01.patch
Last active November 14, 2023 14:28
bibcite-ris-ris-entity-bibtex-20231103-01.patch
diff --git a/modules/bibcite_bibtex/src/Encoder/BibtexEncoder.php b/modules/bibcite_bibtex/src/Encoder/BibtexEncoder.php
index a0ea233..e4f1307 100644
--- a/modules/bibcite_bibtex/src/Encoder/BibtexEncoder.php
+++ b/modules/bibcite_bibtex/src/Encoder/BibtexEncoder.php
@@ -22,14 +22,14 @@ class BibtexEncoder implements EncoderInterface, DecoderInterface {
/**
* {@inheritdoc}
*/
- public function supportsDecoding(string $format): bool {
+ public function supportsDecoding($format): bool {
@slattery
slattery / .lando.local.yml
Last active April 23, 2024 01:01
_lando.local.yml to defeat spinning scanners on macos M2
services:
appserver_nginx:
type: nginx
scanner:
okCodes:
- 302
- 404
- 403
tooling:
drush:
@slattery
slattery / drupal.md
Last active October 11, 2022 14:44 — forked from megclaypool/drupal.md
[I forgot my Password: Command Line Tools to the Rescue!] Note that these commands can also come in handy if your front-end is so messed up that you can't access the login screen...

Drush one-time login link for Drupal accounts

Holy crap, I never knew about this before, but this is awesome.

The command is drush uli

It's got options,

  • name for the username
  • uri to specify the url of the site (our weird setup requires us to specify the url of our site)