Skip to content

Instantly share code, notes, and snippets.

View zxcodes's full-sized avatar
:fishsticks:
Buildin.

Mohammed Farmaan. zxcodes

:fishsticks:
Buildin.
View GitHub Profile
@zxcodes
zxcodes / bench.js
Last active January 24, 2025 02:46
Promise Perf.
const MAX_TEST_RUNS = 10;
/**
* A typical DB response might look or might not look like this.
* This object size and complexity is intentional.
*/
const response = {
id: Math.random(),
name: `Complex Object ${Math.random().toString()}`,
details: {
@zxcodes
zxcodes / GetCurrentLocation.js
Last active May 28, 2023 17:05
Get current device location in React Native with handled permissions. Works for Android and iOS. Requires https://www.npmjs.com/package/react-native-geolocation-service library to request and get location.
const getCurrentUserLocation = async (platform, coords, extendedOptions) => {
// Default options. Can be overriden using extended options.
const options = {
enableHighAccuracy: true,
timeout: 15000,
maximumAge: 0,
...extendedOptions
};
if (platform === 'ios') {