Skip to content

Instantly share code, notes, and snippets.

View mcmullengreg's full-sized avatar

Gregory McMullen mcmullengreg

View GitHub Profile
<?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'] = '';
@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
<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>
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');
@mcmullengreg
mcmullengreg / ColdFusion-Git-Webhook.cfm
Last active December 5, 2022 21:02
Webhoook integration for ColdFusion. Downloads the Zip after a push event and moves the contents to a folder determined based on the repository name. Used as a means of keeping testing environments updated whenever new commits are pushed to the master.
<!--- Webhook secrets -- yours, not mine. --->
<cfset secret = "">
<cftry>
<cfset _payload = "{}">
<cfset _payload = getHttpRequestData()>
<cfset jsonPayload = form.payload>
<cfset hash = RemoveChars(_payload.headers['X-Hub-Signature'], 1, 5)>
<cfset payload_hash = hmac(_payload.content, secret, 'HMACSHA1')>
@mcmullengreg
mcmullengreg / upload-media.js
Created October 14, 2015 18:25
Widget for a featured area with selectable content and using WP image upload.
jQuery(document).ready(function($) {
$(document).on("click", ".upload_image_button", function() {
jQuery.data(document.body, 'prevElement', $(this).prev());
window.send_to_editor = function(html) {
var imgurl = jQuery('img',html).attr('src');
var inputText = jQuery.data(document.body, 'prevElement');
if(inputText != undefined && inputText != '')
@mcmullengreg
mcmullengreg / wp-core.scss
Created August 18, 2015 16:06
WordPress Core - SCSS
/* =WordPress Core
-------------------------------------------------------------- */
.alignnone {
margin: 5px 20px 20px 0;
}
.aligncenter {
display: block;
margin: 5px auto 5px auto;
}
@mcmullengreg
mcmullengreg / simple-mail.php
Last active August 29, 2015 14:26
Simple $_POST Email Form. This form does not contain any form validation and has very little security checking on the backend and nothing on the front end.
<!doctype html>
<html class="no-js" lang="">
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<title>Basic PHP Form Processing</title>
</head>
<body>
<h1>Basic Form</h1>
<?php if (empty($_POST)) : ?>
@mcmullengreg
mcmullengreg / Wordpress.php
Last active August 29, 2015 14:21
Editor Mods for OL Reversed
/*
This code goes in your functions.php
Check your themes functions file as they may already be using this.
*/
// Add Formats Dropdown Menu To MCE
add_filter( 'mce_buttons', 'mce_style_button' );
if ( ! function_exists( 'mce_style_button' ) ) {
function mce_style_button( $buttons ) {
array_push( $buttons, 'styleselect' );
return $buttons;
@mcmullengreg
mcmullengreg / divider.cshtml
Created April 21, 2015 00:12
Global Variables
var divider = (i == 2) ? " | " :
(i > 2) ? " - " : "";