Skip to content

Instantly share code, notes, and snippets.

View ao5357's full-sized avatar
🙂
Probably near my computer, probably something with emails

Brad Czerniak ao5357

🙂
Probably near my computer, probably something with emails
View GitHub Profile
@ao5357
ao5357 / mailAgenda.gs
Last active May 12, 2023 00:09
Google Calendar will send you a daily agenda, but it's at 5:00 AM the day of. This agenda macro (in Google Apps Script) lets you trigger an agenda email to any address on any time interval.
/**
* Gets tomorrow's events and sends along an email agenda.
*/
function mailAgenda(){
// Configs.
var config = {
firstName: 'Brad',
email: 'brad@commercialprogression.com',
ignoreRecurringEvents: true
};
@ao5357
ao5357 / YOURTHEME.theme
Created November 23, 2020 22:27
Getting YouTube thumbnails in the Drupal theming layer
<?php
/**
* Implements hook_preprocess_node().
*/
function YOURTHEME_preprocess_node(&$vars) {
$entity = $vars['node'];
// Change these conditions to suit your use case.
if ($entity->bundle() === 'resource' && $entity->hasField('field_remote_video')) {
@ao5357
ao5357 / WebformElement.php
Created June 15, 2022 13:38
A webform embed element for Acquia Site Studio, including dependency injection
<?php
namespace Drupal\webform_element\Plugin\CustomElement;
use Drupal\cohesion_elements\CustomElementPluginBase;
use Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException;
use Drupal\Component\Plugin\Exception\PluginNotFoundException;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
@ao5357
ao5357 / composer.lock
Created March 21, 2022 20:44
Manually patch guzzlehttp/psr7 to 1.8.5
{
"name": "guzzlehttp/psr7",
"version": "1.8.5",
"source": {
"type": "git",
"url": "https://github.com/guzzle/psr7.git",
"reference": "337e3ad8e5716c15f9657bd214d16cc5e69df268"
},
"dist": {
"type": "zip",
@ao5357
ao5357 / custom.js
Created December 15, 2021 17:32
Failed attempt to use a mutationObserver to replace a Drupal destination parameter on a use-ajax trigger link. The Drupal.ajax event listener registers it before the fix!
/**
* @file
* Global utilities.
*/
var michiganDesignInit = false; // Global scoped to track attachment just once.
(function($, Drupal) {
Drupal.behaviors.michigan_design = {
attach: function(context, settings) {
if (context === document && !michiganDesignInit) {
@ao5357
ao5357 / nypl_events_digital_displays.views.export.php
Created December 6, 2021 03:50
View for managing future d7 events for digital displays
$view = new view();
$view->name = 'nypl_events_digital_displays';
$view->description = 'Admin listings for events on digital displays';
$view->tag = 'default';
$view->base_table = 'node';
$view->human_name = 'Digital Displays';
$view->core = 7;
$view->api_version = '3.0';
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
@ao5357
ao5357 / externla-links.vanilla.js
Created September 30, 2021 18:26
Vanilla JS way to make external links not leak info to their destinations
@ao5357
ao5357 / view--migrate_subscription_databases.php
Last active September 7, 2021 17:15
Migrate D8 XML Views Data Export
$view = new view();
$view->name = 'd8_migrations';
$view->description = 'Views Data Exports for migrating to Drupal 8';
$view->tag = 'default';
$view->base_table = 'node';
$view->human_name = 'D8 Migrate';
$view->core = 7;
$view->api_version = '3.0';
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
@ao5357
ao5357 / tablefield_cellspan-allow_formatted.patch
Created August 4, 2021 14:34
Patch to 8.x-2.x tablefield module to allow cellspan in formatted cells
diff --git a/tablefield_cellspan/tablefield_cellspan.module b/tablefield_cellspan/tablefield_cellspan.module
index 8e343e1..d5b98ec 100644
--- a/tablefield_cellspan/tablefield_cellspan.module
+++ b/tablefield_cellspan/tablefield_cellspan.module
@@ -21,10 +21,6 @@ function tablefield_cellspan_preprocess_table(&$variables) {
foreach ($row['cells'] as $col_key => $cell) {
- if (is_array($cell['content']) || is_object($cell['content'])) {
- break;
@ao5357
ao5357 / token_remove-info-alter-contents_nypl.patch
Created July 9, 2021 20:28
Patch to remove the contents of a token hook for harmony on our d7 site
diff --git a/token.tokens.inc b/token.tokens.inc
index 3d65d6e..d562559 100644
--- a/token.tokens.inc
+++ b/token.tokens.inc
@@ -9,83 +9,7 @@
* Implements hook_token_info_alter().
*/
function token_token_info_alter(&$info) {
- // Force 'date' type tokens to require input and add a 'current-date' type.
- // @todo Remove when http://drupal.org/node/943028 is fixed.