This file contains hidden or 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
import dayjs from 'dayjs' | |
// @param date {string, dayjs object} | |
// @param separator {string} optional - separates year/month/day numbers. Empty string is valid. | |
function formatDateAsYearMonthDay(date, separator = '-') { | |
if (!(date instanceof dayjs || typeof date === 'string')) { | |
return false // Unsupported date type. `undefined` is unsupported. | |
} |
This file contains hidden or 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
<?php | |
// Requires PHP DOM extension. Works with both local files and live ones on the web! | |
if(!isset($argv[1])) { | |
print("getSiteMapURLs.php error: This script takes one argument (the path of the site map to parse).".PHP_EOL); | |
die(); | |
} | |
$urls = ""; |
This file contains hidden or 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
local.people = { | |
"jim": 100, | |
"bob": 500, | |
"sally": 1000 | |
}; | |
local.myStruct = {}; | |
structEach(local.people, function(key, value) { | |
writeDump(key); // name |
This file contains hidden or 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
<cfscript> | |
// Testing sorting an array of structs | |
variables.myArray = [ | |
{ | |
"animal": "cat", | |
"averageAge": 37 | |
}, | |
{ | |
"animal": "dog", |
This file contains hidden or 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
<cfscript> | |
// Get main site's feed. | |
variables.feed = $.getBean("feed"); | |
variables.feed.setSiteID("default"); | |
variables.feed.setMaxItems(0); | |
variables.feed.setSortBy(esapiEncode('html_attr',variables.$.event('sortby'))); | |
variables.feed.setSortDirection(esapiEncode('html_attr',variables.$.event('sortdirection'))); | |
variables.feed.setContentID("57A975C9-155D-11DA-00EE3AC56A450048"); | |
variables.qryMainSite = variables.feed.getQuery(); |
This file contains hidden or 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
// Get position of element from top of viewport. | |
function getPosition(element) { | |
// Modern browsers. | |
if(element.getBoundingClientRect) { | |
var clientRect = element.getBoundingClientRect(); | |
return { | |
x: Math.floor(clientRect.left), | |
y: Math.floor(clientRect.top) |