Skip to content

Instantly share code, notes, and snippets.

View emerham's full-sized avatar

Matthew Brabham emerham

  • Oregon State University
  • Oregon
View GitHub Profile
@emerham
emerham / MigratedPathLookup.php
Created March 15, 2023 16:26 — forked from 5n00p4eg/MigratedPathLookup.php
Drupal 8 migrate menu links with node references
View MigratedPathLookup.php
<?php
namespace Drupal\oht_migrate\Plugin\migrate\process;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Drupal\migrate\Annotation\MigrateProcessPlugin;
use Drupal\migrate\Plugin\migrate\process\MigrationLookup;
use Drupal\migrate\Plugin\MigratePluginManagerInterface;
use Drupal\migrate\Plugin\MigrationInterface;
use Drupal\migrate\ProcessPluginBase;
@emerham
emerham / before-and-after.css
Last active December 6, 2022 18:28
HTML Before and After with css and js
View before-and-after.css
.before-and-after__main {
width: 100%;
max-width: max-content;
}
.before-and-after__wrapper {
position: relative;
user-select: none;
overflow: hidden;
width: 100%;
@emerham
emerham / cqls_fees.js
Created May 26, 2021 21:54
CQLS Fees Table Row Text update for Categories.
View cqls_fees.js
let selectedCategory = document.querySelector('#edit-field-cqls-category-target-id-selective').selectedOptions;
if (selectedCategory.length > 0) {
let selectedCategoryArr = [...selectedCategory];
var selectedCategroyText = selectedCategoryArr.map((option) => {return option.innerText});
let categoryValue = document.querySelectorAll('td.views-field-field-cqls-category');
for (var i = 0; i < categoryValue.length; i++ ) {
var categoryValueArr = categoryValue[i].innerText.split(', ');
var filteredCategories = categoryValueArr.filter((words) => {
return selectedCategroyText.includes(words);
});
View drupal-paragraphs-field-collection.php
<?php
// Rendering Paragraphs Menu Items
$paragraph_items = field_get_items('paragraphs_item', $variables['paragraphs_item'], 'field_p_menu');
$field_collection = field_collection_field_get_entity($paragraph_items[0], 'field_p_menu');
print render(field_view_field('field_collection_item', $field_collection, 'field_p_menu_link', [
'type' => 'link_title_plain',
'label' => 'hidden'
]));
print render(field_view_field('field_collection_item', $field_collection, 'field_p_menu_link', [
'type' => 'link_plain',
View kaltura-media-ids.js
/*
* Injects the ID of the Kaltura video.
*/
document.addEventListener("DOMContentLoaded", function(){
let tbodys = document.getElementsByTagName("TBODY");
let totalTables = tbodys.length;
for (let t = 0; t < totalTables; t++){
let linkData = tbodys[t].getElementsByClassName("views-field views-field-field-url");
let kalturaIdCell = tbodys[t].getElementsByClassName("kaltura-id");
for ( let l = 0; l < linkData.length; l++) {
View qualtrics-salseforce.html
<script>
Qualtrics.SurveyEngine.addOnload(function() {
/*Place your JavaScript here to run when the page loads*/
submitRFI();
});
function submitRFI() {
// Variable for specific Salesforce instances
const env = "osu.secure";
// const env = "sandboxjme-osu.cs9";
@emerham
emerham / id-differences-for-dev-and-prod.json
Last active October 10, 2017 19:40 — forked from jaredkosanovic/id-differences-for-dev-and-prod.json
The old IDs are what are currently in prod, and the new IDs are what's currently in dev. If the building name changed in addition to the ID, then it's not included in this file since we don't have a good way to know that the buildings were the same.
View id-differences-for-dev-and-prod.json
{
"buildings": {
"OSU Open Campus - Corvallis": {
"new": "ce450c4443a09e5635165df7b4a8bd74",
"old": "ce450c4443a09e5635165df7b4a8bd74"
},
"North Porch Cafe": {
"new": "dde04c526a9605a44084a4a9f7e08f96",
"old": "46aca402f531a0d513ef8d9413533866"
},
@emerham
emerham / innobackupex-restore.sh
Last active August 29, 2015 14:26 — forked from dalecaru/innobackupex-restore.sh
Scripts to create and restore full and incremental backups (for all databases on server) using innobackupex from Percona.
View innobackupex-restore.sh
#!/bin/sh
#
# Script to prepare and restore full and incremental backups created with innobackupex-runner.
#
# This script is provided as-is; no liability can be accepted for use.
#
INNOBACKUPEX=innobackupex-1.5.1
INNOBACKUPEXFULL=/usr/bin/$INNOBACKUPEX
TMPFILE="/tmp/innobackupex-restore.$$.tmp"