Skip to content

Instantly share code, notes, and snippets.

@IvoPereira
IvoPereira / pwaDetector.js
Last active February 4, 2025 08:08
Detect if a PWA is installed (iOS Standalone, Trusted Web App, Chrome PWA)
function isPWA() {
return window.navigator.standalone == true || // iOS PWA Standalone
document.referrer.includes('android-app://') || // Android Trusted Web App
["fullscreen", "standalone", "minimal-ui"].some(
(displayMode) => window.matchMedia('(display-mode: ' + displayMode + ')').matches
) // Chrome PWA (supporting fullscreen, standalone, minimal-ui)
}
console.log(isPWA()) // true
@timvisee
timvisee / falsehoods-programming-time-list.md
Last active April 27, 2025 01:29
Falsehoods programmers believe about time, in a single list

Falsehoods programmers believe about time

This is a compiled list of falsehoods programmers tend to believe about working with time.

Don't re-invent a date time library yourself. If you think you understand everything about time, you're probably doing it wrong.

Falsehoods

  • There are always 24 hours in a day.
  • February is always 28 days long.
  • Any 24-hour period will always begin and end in the same day (or week, or month).