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
| Queue = (function makeQueue() { | |
| const map = new Map | |
| function Queue() { | |
| map.set(this, []) | |
| } | |
| Queue.prototype.enqueue = function (item) { | |
| map.get(this).push(item) | |
| } |
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
| showDays() | |
| function showDays() { | |
| const days = [] | |
| const date = new Date | |
| const firstDate = new Date | |
| firstDate.setDate(1) | |
| const firstDateWeekday = firstDate.getDay() |
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
| g = 9.8 / 3000 | |
| state = {y: 0, speed: 0} | |
| body = document.body | |
| ball = document.createElement('div') | |
| ball.id = 'ball' | |
| ball.style = ` | |
| background: orange; | |
| width: 100px; |
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
| [...new Set([ | |
| "I", | |
| "you", | |
| "he", | |
| "she", | |
| "it", | |
| "we", | |
| "they", | |
| "thou", | |
| "ye", |
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
| bst = Object.create({ | |
| empty() { | |
| this.value = null | |
| this.left = null | |
| this.right = null | |
| }, | |
| show() { | |
| let output = `${this.value}` | |
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 getContentSize(el) { | |
| const { | |
| paddingTop, paddingRight, paddingBottom, paddingLeft | |
| } = getComputedStyle(el); | |
| const width = el.clientWidth | |
| - parseFloat(paddingLeft) - parseFloat(paddingRight); | |
| const height = el.clientHeight | |
| - parseFloat(paddingTop) - parseFloat(paddingBottom); | |
| return { width, height }; |
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
| // closed scope (module) | |
| <script type="module"> | |
| import('./script.js?salt='+Date.now()) | |
| </script> | |
| // open scope (global) | |
| <script> | |
| document.write('<script src="./script.js?salt='+Date.now()+'" defer></script>') | |
| document.currentScript.remove() | |
| </script> |
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
| count = 0 | |
| maxDepth = 0 | |
| maxWidth = 0 | |
| listChildren(document.body) | |
| // console.log({count, maxDepth, maxWidth}) | |
| function listChildren(el, depth=0) { //console.log(depth) | |
| if (depth > maxDepth) maxDepth = depth | |
| const tagNames = [] |
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
| getAllClosestCSSValue($0, 'overflow') | |
| function getAllClosestCSSValue(el, property) { | |
| return !el ? [] : [ | |
| el, | |
| property + ': ' + getComputedStyle(el)[property], | |
| ...getAllClosestCSSValue(el.parentElement, property) | |
| ] | |
| } |
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 input1 = [1, 12] | |
| const output1 = [ | |
| [ | |
| [1, 2, 3], | |
| [4, 5, 6], | |
| [7, 8, 9], | |
| [10, 11, 12] | |
| ] | |
| ] |
NewerOlder