Skip to content

Instantly share code, notes, and snippets.

View mlsamuelson's full-sized avatar

Michael Samuelson mlsamuelson

View GitHub Profile
@mlsamuelson
mlsamuelson / acquia-pull
Last active March 31, 2025 16:41
For ACMN-143, .ddev/commands/acquia-pull
#!/bin/bash
###
### This DDEV custom command pulls database and files from
### Acquia DEV environment in a Drupal multisite setup for local development.
###
### Usage: `ddev acquia-pull [ --skip-db ] [ --skip-files ] <site1>`
### Example: `ddev acquia-pull subsite1`
###
### To use it, set up the needed ACQUIA_API_KEY and ACQUIA_API_SECRET
@mlsamuelson
mlsamuelson / CASS-2
Last active December 7, 2024 00:12
<!-- api service --><script src="https://geoip-js.com/js/apis/geoip2/v2.1/geoip2.js"></script><script>
var consentRegionCheck = (function () {
var getConsentRegionCookie = function (cname) {
var name = cname + "=";
var decodedCookie = decodeURIComponent(document.cookie);
var ca = decodedCookie.split(";");
for (var i = 0; i < ca.length; i++) {
var c = ca[i];
while (c.charAt(0) == " ") {
c = c.substring(1);

Keybase proof

I hereby claim:

  • I am mlsamuelson on github.
  • I am mlsamuelson (https://keybase.io/mlsamuelson) on keybase.
  • I have a public key ASC-ihvgJryngArv_ag4Unl33wVr7JxWev1k1sbfhTB9Ego

To claim this, I am signing this object:

@mlsamuelson
mlsamuelson / asu_dept_orgchart.module
Created April 22, 2015 18:29
using root_deptid to set dept hierarchy widget build root
/**
* Content for Dept Hierarchy display
* @return string : The HTML to display
*/
function asu_dept_orgchart_departments_content($root_deptid = NULL) {
$tree = &drupal_static(__FUNCTION__);
if (!isset($tree)) {
// Check for cache
if ($cache = cache_get('asu_dept_orgchart_tree')) {
$tree = $cache -> data;
@mlsamuelson
mlsamuelson / gist:ce081c21ca83795f2b14
Created May 23, 2014 17:25
Drupal 7: how to disable select box and not lose the selected value when using Chosen
(function ($) {
// If select list only has one option... (Optional)
if ($('#edit-field-rfi-program-und option').size() == 1) {
// Disable select list, and trigger Chosen to register that change.
$('#edit-field-rfi-program-und').prop('disabled', true).trigger("chosen:updated");
@mlsamuelson
mlsamuelson / gist.txt
Created October 4, 2013 19:27
lp courses sku api
$sku = 5156486456; // Prov A test class [nid:172]
// Get the product the SKU is associated with.
$product = commerce_product_load_by_sku($sku);
dpm($product);
// Get the course the SKU falls under.
$course = lp_courses_get_sku_course($sku);
dpm($course);