A tiny ~150-byte polyfill for Promise.prototype.finally
.
Useful for browsers that support Promise but not the .finally()
method.
npm install finally-polyfill
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Single File Web Component</title> | |
</head> | |
<body> | |
<template id=single-file> | |
<style> | |
h1 { |
/* | |
Copy this into the console of any web page that is interactive and doesn't | |
do hard reloads. You will hear your DOM changes as different pitches of | |
audio. | |
I have found this interesting for debugging, but also fun to hear web pages | |
render like UIs do in movies. | |
*/ | |
const audioCtx = new (window.AudioContext || window.webkitAudioContext)() |
export default { | |
const parents = getNamedParents(this.$router.options.routes, this.$route.matched) | |
if (parents.length) { | |
return { | |
name: parents[parents.length - 1].name, | |
} | |
} | |
return { name: 'home' } | |
} |
*, *:before, *:after { box-sizing: border-box; } |
// https://github.com/calebdwilliams/construct-style-sheets | |
import "construct-style-sheets-polyfill"; | |
export default strings => { | |
if (document.readyState === "loading") { | |
window.addEventListener("DOMContentLoaded", () => adopt(strings)); | |
} else { | |
adopt(strings); | |
} | |
}; |
// create a bookmark and use this code as the URL, you can now toggle the css on/off | |
// thanks+credit: https://dev.to/gajus/my-favorite-css-hack-32g3 | |
javascript: (function() { | |
var styleEl = document.getElementById('css-layout-hack'); | |
if (styleEl) { | |
styleEl.remove(); | |
return; | |
} | |
styleEl = document.createElement('style'); | |
styleEl.id = 'css-layout-hack'; |
invoices/123
?
in a URL like /assignments?showGrades=1
.#
portion of the URL. This is not available to servers in request.url
so its client only. By default it means which part of the page the user should be scrolled to, but developers use it for various things.<!DOCTYPE html><html lang=en> | |
<title>Page Not Found</title> | |
<meta charset=utf-8> | |
<meta name=viewport content="width=device-width,initial-scale=1"> | |
<h1>Page Not Found</h1> | |
<p>Sorry, but the page you were trying to view does not exist.</p> |