Skip to content

Instantly share code, notes, and snippets.

View mdrobny's full-sized avatar

Michał Drobniak mdrobny

View GitHub Profile
@neg4n
neg4n / paste-this-into-console.js
Created April 26, 2021 20:39
Unregister all service workers in Safari
// Simple & convinient way to remove all service workers registered for specific web page
// Useful when working with PWA
// Paste code below to the console, it should return Promise
const getRidOfAllServiceWorkers = async () => {
const registry = await navigator.serviceWorker.getRegistrations()
for (const entry of registry) {
entry.unregister()
}
}
@sindresorhus
sindresorhus / esm-package.md
Last active March 16, 2026 04:38
Pure ESM package

Pure ESM package

The package that linked you here is now pure ESM. It cannot be require()'d from CommonJS.

This means you have the following choices:

  1. Use ESM yourself. (preferred)
    Use import foo from 'foo' instead of const foo = require('foo') to import the package. You also need to put "type": "module" in your package.json and more. Follow the below guide.
  2. If the package is used in an async context, you could use await import(…) from CommonJS instead of require(…).
  3. Stay on the existing version of the package until you can move to ESM.
@jazio
jazio / gist:d45d4d97aab63574b0bb5488cde6babb
Last active August 23, 2024 20:46
Install Custom ROM
Special boot modes
Recovery: With the device powered off, hold Volume Up + Power. Keep holding both buttons until the “MI” logo appears on the screen, then release.
Download: With the device powered off, hold Volume Down + Power. Keep holding both buttons until the word “FASTBOOT” appears on the screen, then release.
Steps.
@sebmarkbage
sebmarkbage / transferring-props.md
Last active September 27, 2024 00:10
Deprecating transferPropsTo

Deprecating transferPropsTo

It's a common pattern in React to wrap a component in an abstraction. The outer component exposes a simple property to do something that might have more complex implementation details.

We used to have a helper function called transferPropsTo. We no longer support this method. Instead you're expected to use a generic object helper to merge props.

render() {
 return Component(Object.assign({}, this.props, { more: 'values' }));