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
| /** | |
| * @param {number} initialization | |
| * @param {Function} condition predicate | |
| * @param {Function} afterthought | |
| * @param {Function} f | |
| * @returns The last value that was not operated on by f | |
| */ | |
| const fFor = (initialization, condition, afterthought, f) => { | |
| if (!condition(initialization)) return initialization; | |
| f(initialization); |
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 targetDate = "2025-08-03 10:55:00"; | |
| const remainDays = Math.floor( | |
| (new Date(targetDate).getTime() - new Date().getTime()) | |
| / | |
| (1000 * 60 * 60 * 24) | |
| ); |
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 count = 16; | |
| const result = Array.from({length:count},(_,k)=>k+1).map(n=>-12*Math.log2(1-1/n)); |
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
| .cm-trailing-space-new-line::before { | |
| content: "↵"; | |
| position: absolute; | |
| opacity: 0.5; | |
| } |
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
| [...document.querySelector(/* css query */).children] |
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 trampoline(f) { | |
| return (...args) => { | |
| let result = f(...args); | |
| while (typeof result === 'function') { | |
| result = result(); | |
| } | |
| return result; | |
| }; | |
| } |
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
| UnaryOperator<Integer> fact = new UnaryOperator<>() { | |
| @Override | |
| public Integer apply(Integer n) { | |
| return ((Function<UnaryOperator<Integer>, UnaryOperator<Integer>>) self -> x -> (x <= 1) ? 1 : x * self.apply(x - 1)).apply(this).apply(n); | |
| } | |
| }; |
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
| import java.util.Arrays; | |
| final class HzExchange { | |
| /** | |
| * Suppresses default constructor, ensuring non-instantiability. | |
| */ | |
| private HzExchange() { | |
| } |
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* generateJustIntonationFrequency(count = 1, start = 440, numerator = 3, denominator = 2) { | |
| let hz = start; | |
| let i = 0 | |
| while (i++ < count) { | |
| yield hz; | |
| hz *= numerator / denominator; | |
| } | |
| } |
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
| ^\s*\*\s* |