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'] = '';
<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) ? " - " : "";
@mcmullengreg
mcmullengreg / StructuredTitles.cshtml
Created April 21, 2015 00:05
Umbraco Structured Titles
@{
var homePage = "";
var pagesTitle = "";
var CatTitle = "";
var Level4Parent = "";
@* - HOMEPAGE TITLE - *@
if ( @Model.Level <= 1 && @Model.AncestorOrSelf(1).HasValue("pageTitle") ) {
homePage = @Model.AncestorOrSelf(1).pageTitle; }
else {