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
{ | |
"recommendations": [ | |
"charliermarsh.ruff" | |
] | |
} |
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
/** | |
* Stops other media elements from playing when a media element starts playing. | |
* | |
* @param {HTMLMediaElement[]} mediaElems - An array of HTML media elements. | |
* | |
* @example | |
* | |
* // Stop other media elements when one starts playing | |
* const allMediaElems = document.querySelectorAll("audio, video"); | |
* stopOtherMedia(allMediaElems); |
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
{ | |
"recommendations": [ | |
"ms-python.python", | |
"ms-python.pylint", | |
"ms-python.black-formatter", | |
"ms-python.isort" | |
] | |
} |
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
def dict_unique(dict): | |
""" | |
Return a dictionary containing unique values from a given dictionary. | |
Args: | |
dict (dict): The input dictionary. | |
Returns: | |
dict: A new dictionary with unique values. |
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
import re | |
import unicodedata | |
DIACRITICS_MAP = { | |
"À": "A", | |
"Ĕ": "E", | |
"Ļ": "L", | |
"Ś": "S", | |
"Ź": "Z", | |
"ē": "e", |
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
import numpy as np | |
def list_unique(arr): | |
""" | |
Return a list containing unique values from a given array. | |
Args: | |
arr (list or numpy.ndarray): The input list. | |
Returns: |
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
import numpy as np | |
def array_unique(arr): | |
""" | |
Return an array containing unique values from a given array. | |
Args: | |
arr (list or numpy.ndarray): The input array. | |
Returns: |
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
/** | |
* @typedef {Object} I18nFormatDisplayNamesType - creates a new type named "I18nFormatDisplayNamesType" | |
* @property {string} code - The currency-, language-, region-/country- or script-code for which to retrieve the display name. | |
* @property {string} [locale="en-US"] - The locale (keyof typeof Intl.Locale) to use for formatting the display name. | |
* | |
* @description | |
* - Currency code: The first two letters of the ISO 4217 three-letter code are the same as the code for the country name, and, | |
* where possible, the third letter corresponds to the first letter of the currency name. | |
* - Language code: Unicode base language code based on BCP47 subtag values marked as Type "language". | |
* - Region code: Unicode region code based on BCP47 subtag values marked as Type "region". |
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
/** | |
* @typedef {Object} I18nFormatDateType - creates a new type named "I18nFormatDateType" | |
* @property {string} [dateString] - The string representation of the date to be formatted. Defaults to current date. | |
* @property {string} [locale="en-US"] - The locale (keyof typeof Intl.Locale) to use for formatting the date. | |
* @property {Intl.DateTimeFormatOptions} [formatOptions] - The options for formatting the date. | |
*/ | |
/** | |
* Formats a date with internationalization. | |
* |
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
import parsePhoneNumber from "libphonenumber-js"; | |
/** | |
* @typedef {Object} FormatPhoneNumberType - creates a new type named "FormatPhoneNumberType" | |
* @property {string} number - The phone number to format. | |
* @property {"NATIONAL" | "INTERNATIONAL" | "RFC3966"} [property="INTERNATIONAL"] - The desired formatting property. | |
*/ | |
/** | |
* Formats a phone number using the libphonenumber-js library. |
NewerOlder