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
/** | |
* Sets the character stored in FAVICON_CHARACTER as the favicon for this page. | |
*/ | |
addEventListener('DOMContentLoaded', () => { | |
// The single character that will appear as the favicon for this page. | |
const FAVICON_CHARACTER = '\u{1F510}'; | |
// Remove all `<link>` elements that are for icons. | |
document.querySelectorAll("link[rel~='icon']").forEach(el => el.remove()); |
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
/** | |
* Sets the favicon for the page to show one letter per second of the | |
* MARQUEE_TEXT constant. The background will be a solid color that slowly | |
* changes, cycling through different hues. | |
*/ | |
addEventListener('DOMContentLoaded', () => { | |
const MARQUEE_TEXT = 'A TEST '; | |
// The canvas that will be used to generate the image that will show as the | |
// favicon once every second. |
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
/** | |
* Sorts an array based on one or more criteria. | |
* | |
* @template T | |
* @param {T[]} array - The array to sort. | |
* @param {...(((item: T, index: number) => any) | ({getter: (item: T, index: number) => any, reverse: boolean}))} criterion - | |
* One or more sorting criteria. Each can be a getter function or an object with a getter and a reverse flag. | |
* @returns {T[]} A new array sorted based on the provided criteria. | |
*/ | |
function order(array, ...criterion) { |
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
/** | |
* @template T | |
* @param {T} value | |
* @param {boolean} [omitCircularRefs=false] | |
* @returns {T} | |
*/ | |
function copyJSON(value, omitCircularRefs = false) { | |
const ancestors = new WeakSet(); | |
function recurse(value) { |
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 static String[] getFieldNames(String sobjectName) { | |
String[] fieldNames = new String[]{}; | |
Schema.SObjectType sobjectType = Schema.getGlobalDescribe().get(sobjectName); | |
if (sobjectType != null) { | |
Map<String, Schema.SObjectField> fieldsMap = sobjectType.getDescribe().fields.getMap(); | |
fieldNames.addAll(fieldsMap.keySet()); | |
} | |
return fieldNames; | |
} |
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
from typing import Optional | |
def split( | |
input_string: str, | |
sep: Optional[str] = None, | |
max_split: int = -1, | |
exclusions: Optional[list[str]] = None, | |
strip_items: bool = False | |
) -> list[str]: |
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
/** | |
* Converts a positive integer into an alphabetic representation, similar to | |
* ordered list lettering and Excel column naming. | |
* | |
* @param {number} int | |
* The positive integer to convert. Non-integers will be floored. | |
* @param {boolean} [returnLowerCase=false] | |
* If `true`, returns lowercase letters (e.g., 'a', 'b', ...). | |
* If `false`, returns uppercase letters (e.g., 'A', 'B', ...). | |
* @returns {string} |
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
/** | |
* Shows the file selector dialog and returns an array of the selected files. | |
* @param {?selectFile__Options=} options | |
* @returns {Promise<File[]>} | |
*/ | |
function selectFile(options) { | |
return new Promise(resolve => { | |
function onClose(e) { | |
resolve([...e.target.files]); | |
} |
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
/** | |
* @param {Record<"codeEditor"|"diffEditor",boolean|string>} defsToInclude | |
* @returns {Record<string,any>} | |
*/ | |
function getMonacoEditorCompDefs(defsToInclude) { | |
/** | |
* @param {(script?: HTMLScriptElement) => T} getter | |
* Function that will be called to get the result of a script running. This | |
* function will initially be called without any arguments to determine if | |
* the desired results already exist but if not the script tag will be added |
NewerOlder