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
/** | |
* Function that waits for the DOM to be ready to be manipulated. | |
* @returns {Promise<undefined>} | |
* A promise that will be finished after the DOM is ready to be manipulated. | |
*/ | |
function waitForReadyDOM() { | |
return new Promise(async resolve => { | |
if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', () => resolve()); | |
else resolve(); | |
}); |
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
/** | |
* Determines if `input` is a primitive value or not. | |
* @param {any} input | |
* The input value to test. | |
* @returns {boolean} | |
* Returns `true if `input` is a primitive, otherwise `false` is returned. | |
*/ | |
function isPrimitive(input) { | |
if (input == null) { | |
// This is here to correctly handle document.all. |
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
class Searcher { | |
/** @type {string} */ | |
#terms; | |
/** @type {boolean} */ | |
#matchWordStart; | |
/** @type {boolean} */ | |
#matchWordEnd; | |
/** @type {RegExp} */ | |
#rgxFullNeg; | |
/** @type {RegExp} */ |
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
public class FlowUtils { | |
@InvocableMethod(label='Format Date/Time') | |
public static String[] format(FormatInput[] inputs) { | |
String[] outputs = new String[0]; | |
for (FormatInput input : inputs) { | |
outputs.add(input.dt.format(input.format, input.tz)); | |
} | |
return outputs; | |
} |
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
/** | |
* Makes it easier to sort an array of values by allowing you to specify 1 or | |
* more key values for each array value. | |
*/ | |
public class KeySorter { | |
/** | |
* Represents a key that will be used to sort a value passed into `KeySorter`. | |
* This class is only addressable internally. | |
*/ | |
private class ComparableKey implements Comparable { |
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
/** | |
* Author: Chris West | |
* Description: | |
* Makes it possible to easily loop through all of the instances of a pattern | |
* within a string and replace the matches with something different. | |
*/ | |
public class PatternReplacer { | |
public Matcher matcher {get; private set;} | |
public String match { | |
get { return p_match; } |
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
public class JSONValue { | |
private Object objValue; | |
public JSONValue(String serialized) { | |
this.objValue = JSON.deserializeUntyped(serialized); | |
} | |
private JSONValue(Object unserialized) { | |
this.objValue = unserialized; | |
} |
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
/** | |
* Takes a date and returns it as a string in the format | |
* `YYYY-MM-DDTHH:mm:ss.SSSZ`. If the `timeZone` given is `"UTC"` or `"GMT"` | |
* the `Z` will remain as `"Z"`, otherwise it will be replaced with the timezone | |
* offset (eg. `"-05:00"`). | |
* @param {Date} inputDate | |
* The date to convert to a JSON format. | |
* @param {?string=} timeZone | |
* Optional, defaults to the user's time zone. The time zone to use when | |
* getting the YMD format (eg. `"America/Los_Angeles"`). |
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
var formatIntlDate = (() => { | |
const CODE_TO_PROP_NAME = { | |
Y: ['year', 'numeric'], | |
M: ['month', 'long'], | |
D: ['day', 'numeric'], | |
WD: ['weekday', 'long'], | |
h: ['hour', '2-digit'], | |
m: ['minute', '2-digit'], | |
s: ['second', '2-digit'], | |
ms: ['fractionalSecondDigits', 3], |
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
/** | |
* Reads the row values of the specified Google Sheet that was published to the | |
* web without needing an API key. | |
* @param {string} publishedURL | |
* The URL of the sheet that you want to read from as copied from the "Publish | |
* to the Web" modal in Google Sheets. To get the contents of a sheet other | |
* than the first one you must use the URL of that sheet when selecting it in | |
* the "Publish to the Web" modal in Google Sheets. | |
* @returns {Promise<(boolean|null|number|string)[][]>} | |
*/ |