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
// Testing how instanceof handles different string inputs. | |
// It returns false positives. | |
// for safer alternatives see: https://salesforce.stackexchange.com/questions/392364/apex-instanceof-id-sometimes-false-positive | |
@isTest static void test_instanceOf() { | |
// String str = 'cam - 123'; | |
// String str = '701andIamNotARealId'; | |
// String str = '003BC00000ArsxPYAR'; // says this is an ID, but ID is from other org | |
String str = '243;0919957138;z71'; // says this is an Id; it obviously isn't | |
Boolean isId; |
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
/** | |
* Is `s` both 1) defined, 2) a string, and 3) not empty? | |
* Can also be used as a TS type predicate to remove `undefined` values. | |
*/ | |
export function isNonEmptyString(s?: string): s is string { | |
return Boolean( | |
typeof s === 'string' && | |
s.length > 0 | |
); |
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
/** | |
* Return a Map of items to their indices in the array. | |
* | |
* The Map will have an entry for each item in A, with the item as the key and | |
* an array of indices as the value. | |
* | |
* There will be as many items in the Map as there are unique items in `A`. | |
* | |
* @param A an array of items of any type `T` | |
* |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
@keyframes prep { | |
0% { | |
transform: translate(-150%); | |
} | |
100% { | |
transform: translate(-150%); | |
} | |
} | |
@keyframes slide { |
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
{ | |
"name": "anything", | |
"version": "0.1.0", | |
"dependencies": { | |
"@mapbox/mapbox-sdk": "^0.10.0", | |
"@mapbox/polyline": "^1.1.0", | |
"@material-ui/core": "^4.8.2", | |
"@material-ui/icons": "^4.5.1", | |
"@turf/circle": "^6.2.0-alpha.1", | |
"@turf/distance": "^6.2.0-alpha.1", |
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
// __mocks__/stripe.ts: Jest Mock for Stripe class | |
/** | |
* Fake a response from stripe.customers.list(). | |
* @example | |
* mockStripeCustomerList(1) === { data: ['fake customer'], object: 'list', … } | |
* @param count number of fake customers to return | |
*/ | |
export const mockStripeCustomerList = (count: number) => ({ | |
data: (new Array(count)).fill('fake customer'), |
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 { NO_CONTENT } from 'http-status-codes'; | |
const send204 = (req: Request, res: Response, next: NextFunction) => { | |
res.status(NO_CONTENT); | |
res.end(); | |
}; |
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 { NextFunction, Request, Response } from 'express'; | |
/** | |
* Sets Allow header. | |
* | |
* "The Allow header lists the set of methods support by a resource. | |
* This header must be sent if the server responds with a 405 Method Not Allowed | |
* status code to indicate which request methods can be used." | |
* | |
* |
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
/** | |
* Returns whether the current browser supports | |
* the `locales` argument of Number.prototype.toLocaleString(). | |
* IE < 11 does not. | |
* Copied from https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toLocaleString#Checking_for_support_for_locales_and_options_arguments | |
* @return {boolean} true if browser supports it, otherwise false. | |
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toLocaleString#Browser_compatibility | |
*/ | |
function toLocaleStringSupportsLocales() { | |
const number = 0; |
NewerOlder