Skip to content

Instantly share code, notes, and snippets.

@7c78
7c78 / event-loop.md
Created November 30, 2020 11:44 — forked from jesstelford/event-loop.md
What is the JS Event Loop and Call Stack?

Regular Event Loop

This shows the execution order given JavaScript's Call Stack, Event Loop, and any asynchronous APIs provided in the JS execution environment (in this example; Web APIs in a Browser environment)


Given the code

@7c78
7c78 / pkce-generator.html
Created April 14, 2020 22:34 — forked from tonyxu-io/redirect.md
PKCE Code Verifier and Code Challenge Generator. DEMO:https://tonyxu-io.github.io/pkce-generator/
<!DOCTYPE html>
<html>
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/3.1.9-1/crypto-js.min.js"></script>
<script>
function generateCodeVerifier() {
var code_verifier = generateRandomString(128)
document.getElementById("code_verifier").value = code_verifier
}
@7c78
7c78 / what-forces-layout.md
Created February 5, 2020 10:37 — forked from paulirish/what-forces-layout.md
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Element

Box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
  • elem.clientLeft, elem.clientTop, elem.clientWidth, elem.clientHeight
  • elem.getClientRects(), elem.getBoundingClientRect()