Skip to content

Instantly share code, notes, and snippets.

View mcmullengreg's full-sized avatar

Gregory McMullen mcmullengreg

View GitHub Profile
function() {
var isSet = function(val) {
return val !== null && val !== '';
};
var el = {{element}};
var val = ( isSet(el.getAttribute('data-label')) ? el.getAttribute('data-label') : el.text );
while (el && el !== document.body && !isSet(val)) {
el = el.parentElement;
val = el.getAttribute('data-label');
<cffunction name="phoneFormat">
<cfargument name="phoneNumber">
<cfset areacode = left(phoneNumber, 3)>
<cfset firstthree = mid(phoneNumber, 4, 3)>
<cfset lastfour = right(phoneNumber, 4)>
<cfreturn "(#areacode#) #firstthree#-#lastFour#">
</cffunction>
@mcmullengreg
mcmullengreg / _template.vm
Last active February 24, 2026 20:23
Shortcode Macro build-out. Default loads in all of the formats associated with shorcodes, then process the HTML passed in. Form builds out our form Embed code to be included on a page. Substring-start-end, just passes in a string with start/end position to get the value.
#*
This page serves as a template and guide to developing and/or editing new shortcodes
Shortcodes should all be stored inside of: _cms/macros/shortcodes/{name}
The shortcode, file and macro names should match exactly. The name is used as a check to:
1. Import the macro file
2. "Name" the macro itself
3. Trigger a check for which macro to run (inside of do_shortcode)
i.e. #macro form ; shortcode is [form id=""]; filename is form
<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
$_SERVER['CASCADE_URI'] = '';
$_SERVER['CASCADE_USER'] = '';
$_SERVER['CASCADE_PASS'] = '';