This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* File modal.js | |
* | |
* Deal with multiple modals and their media. | |
*/ | |
window.wdsModal = {}; | |
( function( window, $, app ) { | |
let $modalToggle, | |
$focusableChildren, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Ruthlessly stolen from Wes Bos' ESLint pre commit hook, and expanded to also run PHPCS. | |
#!/bin/bash | |
jsfiles=$(git diff --cached --name-only | grep '\.jsx\?$') | |
# Only do something if we have JS files. | |
if [[ $jsfiles != "" ]] ; then | |
jsfailed=0 | |
for jsfile in ${jsfiles}; do | |
git show :$jsfile | eslint $jsfile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function cheffism_age_function($atts) { | |
extract(shortcode_atts(array( | |
'date' => '12/31/1900', // DOB | |
'format' => 'dd/MM/YYYY' // Format, does not currently do anything | |
), $atts)); | |
//explode the date to get month, day and year | |
$date = explode("/", $date); | |
//get age from date or birthdate |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Uses Google Code built in Maps Geocoder to obtain coordinates for a place in the US, for example: Tucson, AZ | |
* Usage: On a sheet, select "Tools" -> "Script editor" and paste below (modify output as necessary) | |
* Then set the value for a blank column to =getCoords(locationCell) | |
* ie. =getCoords(B2) | |
* Expected format: City, State | |
* Format example: Tucson, AZ | |
*/ | |
function getCoords(value) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Generates a snippet of HTML code based on data in cells. | |
* Usage: On a sheet, select "Tools" -> "Script editor" and paste below (modify output as necessary) | |
* Then set the value for a blank column to =generateHTML(dateCell, titleCell, locationCell, linkCell) | |
* ie. =generateHTML(B2, C2, D2, E2) | |
*/ | |
function generateHTML(date, title, location, link) { | |
var html = Utilities.formatString( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ES5 does technically not have classes, and so the closest approximation would be something like this: | |
function Animal( name ) { | |
this.name = name; | |
} | |
function Dog() { | |
Animal.call( this, "Dog" ); | |
} | |
Dog.prototype = Object.create(Animal.prototype); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function () { | |
var greeter = (function () { | |
var greeting = "Hey"; | |
var name = "you"; | |
function setName( newName ) { | |
name = newName; | |
} | |
function greet() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function greeting( subject ) { | |
var message = "Hello %s!"; | |
// hello() will have access to the message variable in the greeting() scope. | |
function hello() { | |
return message.replace("%s", subject); | |
} | |
return hello(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Add this to the confirmation page or confirmation text box on forms where AJAX is disabled. | |
// It will fire as soon as the confirmation page is loaded. | |
(function($){ | |
$(document).ready(function(){ | |
// Send event with category 'Form', action 'Submit', label 'Contact Us', and value 100. | |
ga('send', 'event', 'Form', 'Submit', 'Contact Us', 100); | |
}); | |
})(jQuery); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Can be added on any page with a gravity form, it will hook into GF's own event that triggers when the confirmation is loaded (confirmed conversion). | |
(function($) { | |
$(document).bind("gform_confirmation_loaded", function(e, form_id) { | |
// Send event with category 'Form', action 'Submit', label 'Contact Us', and value 100. | |
ga('send', 'event', 'Form', 'Submit', 'Contact Us', 100); | |
}); | |
})(jQuery); |