Skip to content

Instantly share code, notes, and snippets.

@stretch07
stretch07 / sw.js
Created April 14, 2024 20:25
simple service worker that caches all URLs that are fetced in a whitelist
const RUNTIME = "RUNTIMENAME"
const HOSTNAME_WHITELIST = [
self.location.hostname,
]
// The Util Function to hack URLs of intercepted requests
const getFixedUrl = (req) => {
let now = Date.now()
let url = new URL(req.url)

Keybase proof

I hereby claim:

  • I am stretch07 on github.
  • I am stretch07 (https://keybase.io/stretch07) on keybase.
  • I have a public key ASDL2v_nKku7zJw4qzo4GHoPPMKR_tjH9Rjuf5x4tpLA0Ao

To claim this, I am signing this object:

@stretch07
stretch07 / dir2json.html
Last active May 7, 2022 03:28
Easily structure your directory into JSON with dir2json
<!doctype html>
<html>
<head>
<title>dir2json</title>
<style>
button {
background-color: khaki;
border: none;
color: white;