This file contains hidden or 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
| const canIRun = navigator.mediaDevices.getDisplayMedia | |
| const takeScreenShot = async () => { | |
| const stream = await navigator.mediaDevices.getDisplayMedia({ | |
| video: { mediaSource: 'screen' }, | |
| }) | |
| // get correct video track | |
| const track = stream.getVideoTracks()[0] | |
| // init Image Capture and not Video stream | |
| const imageCapture = new ImageCapture(track) |
This file contains hidden or 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 id() { | |
| return crypto.randomUUID().split('-').map(x => parseInt(x, 16).toString(36)).join('') | |
| } |
This file contains hidden or 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
| // Standard normal variate using Box-Muller transform | |
| // https://en.wikipedia.org/wiki/Box-Muller_transform | |
| function normalrand() { | |
| let u = 0, v = 0; | |
| while (u === 0) u = Math.random(); | |
| while (v === 0) v = Math.random(); | |
| return Math.sqrt(-2.0 * Math.log(u)) * Math.cos(2.0 * Math.PI * v); | |
| } |
This file contains hidden or 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
| exports.amount = function(amount) { | |
| if (isNaN(amount)) return exports.amount(0) | |
| if (amount < 0) return `-${exports.amount(-amount)}` | |
| let result = (Math.round(amount * 100) + '').padStart(3, '0') | |
| let [number, float] = [result.slice(0, -2), result.slice(-2)] | |
| let thousands = [] | |
| for (let i = 1; -3 * i >= -number.length; i++) { | |
| thousands.unshift(number.slice(-3 * i, (-3 * i + 3) || undefined)) |
This file contains hidden or 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
| git diff --stat 4b825dc642cb6eb9a060e54bf8d69288fbee4904 | |
| % This shows the differences from the empty tree to your current working tree. | |
| % Which happens to count all lines in your current working tree. |
This file contains hidden or 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
| \overbrace{\left(\ddot{\stackrel{\quad>}{\smile}}\right)}_{\begin{align}\hline\qquad\end{align}} |
This file contains hidden or 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
| ( °-°) ┬─┬ •ノ(°-° ) | |
| ( °-°)ヽ° ┬─┬ (°-° ) | |
| ( °-°) ┬─┬ •ノ(°-° ) | |
| ( °-°)ヽ° ┬─┬ (°-° ) | |
| ( °-°) ┬─┬ •ノ(°-° ) | |