This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8" /> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |
<title>setInterval implementations</title> | |
</head> | |
<body> | |
<div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8" /> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |
<title>Power Saving Mode detection</title> | |
</head> | |
<body> | |
<div>Power Saving Mode? <code id="powerSavingMode"></code></div> | |
<script type="module"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8" /> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |
<title>Document</title> | |
<style> | |
.container{ | |
width: 1280px; | |
margin: 0 auto; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import foo from 'foo'; | |
import bar from 'bar'; | |
console.log(foo, bar); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<title>Script Error Repoter</title> | |
</head> | |
<body> | |
<h1>Script Error Repoter</h1> | |
<button id="raiseError">Raise an error</button> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8" /> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |
<title>Wave Length to Color Example</title> | |
<style> | |
body, p{ | |
margin: 0; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<h2>screen.orientation</h2> | |
<p id="msg"> </p> | |
<pre><code id="output">...</code></pre> | |
<script type="module"> | |
import {ponyfill, polyfill} from './screen-orientation.js'; | |
const $ = (s, c = document) => c.querySelector(s); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<h3>native navigator.userAgentData</h3> | |
<pre><code id="naviveUserAgentData">...</code></pre> | |
<h3>polyfilled navigator.userAgentData</h3> | |
<pre><code id="customUserAgentData">...</code></pre> | |
<script type="module"> | |
import {ponyfill, polyfill} from './user-agent-data.js'; | |
const $ = (s, c = document) => c.querySelector(s); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function filterNums(nums, jitter = 0.2, downJitter = 1 - 1 / (1 + jitter)) { | |
let len = nums.length; | |
let mid = Math.floor(len % 2 === 0 ? len / 2 : (len - 1) / 2), low = mid, high = mid; | |
let lower = true, higher = true; | |
let sum = nums[mid], count = 1; | |
for (let i = 1, j, num; i <= mid; i += 1) { | |
if (higher) { | |
j = mid + i; | |
if (j === len) | |
break; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- to resolve synchronously --> | |
<script src="resolve-template.js"></script> | |
<!-- to resolve asynchronously --> | |
<script> | |
let worker = new Worker('resolve-template.js'); | |
let idGen = (function* () { | |
for (let i = 0; true; i = (i + 1) >> 0) { | |
yield i; | |
} |