Skip to content

Instantly share code, notes, and snippets.

View ptts's full-sized avatar
🏠
Working from home

Patrick ptts

🏠
Working from home
View GitHub Profile
#!/bin/bash
DATETIME=$(date '+%Y%m%d%H%M%S')
echo "This script will rename the Outlooks database to force a recreation"
read -p "Press enter to continue or close this window to abort."
# Force Outlook Profile rebuild (can take up to an hour)
OUTLOOK_PROFILES_DIR="$HOME/Library/Group Containers/UBF8T346G9.Office/Outlook/Outlook 15 Profiles"
@ptts
ptts / with-min-delay.ts
Created December 8, 2024 13:55
A wrapper around a promise or function to enforce a minimum delay, e.g. for artificial delays in UIs
/**
* Ensures that a promise resolves or rejects after at least a specified delay.
*
* @param promiseOrFn - A promise or a function that returns a promise or value.
* @param delay - Minimum time (in ms) to wait before resolving or rejecting (default: 800ms).
* @param options - Configuration object:
* - delayRejection (default: false): If true, ensures that rejections also respect the minimum delay.
* @returns The resolved value of the provided promise.
* @throws If the provided promise rejects or if `promiseOrFn` is a function that throws.
*/
import { useQuery } from "@tanstack/react-query";
export const GeoLocationErrorCode = {
NOT_SUPPORTED: "NOT_SUPPORTED",
PERMISSION_DENIED: "PERMISSION_DENIED",
POSITION_UNAVAILABLE: "POSITION_UNAVAILABLE",
TIMEOUT: "TIMEOUT",
UNKNOWN: "UNKNOWN",
} as const;