Skip to content

Instantly share code, notes, and snippets.


Patrick Thurmond pthurmond

View GitHub Profile
pthurmond / .gitignore
Last active July 26, 2022 20:44
Example of a Drupal 8 composer file with patches
View .gitignore
# Ignore directories generated by Composer
pthurmond /
Last active January 7, 2022 21:05
Pause YouTube videos on slide change. Example with SwiperJS and Drupal 9.


This requires one more thing. The YouTube video URL needs parameters to tell it to accept commands. In my application, which is Drupal 9, I use a hook to modify the URL of all YouTube video URLs.

Example URL:

Specifically, the "enablejsapi" parameter is what enables this. I will also share a php file with the Drupal hook I used for this.

To learn more about the optional parameters you can pass, look at this documentation:

pthurmond / associative_array_splicer.php
Last active April 17, 2021 04:10
This is a tool to allow a programmer to easily insert a new associative index into a desired position in a PHP associative array.
View associative_array_splicer.php
* Insert an associative array into a specific position in an array.
* @param array $original
* The original array to add to.
* @param array $new
* The new array of values to insert into the original.
* @param int $offset
* The position in the array ( 0 index ) where the new array should go.