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 {Generator} generator | |
| * @return {[Function, Promise]} | |
| */ | |
| const CANCELLED = "Cancelled"; | |
| var cancellable = function (generator) { | |
| const { | |
| promise : resultPromise, | |
| resolve : resolveResultPromise, | |
| reject : rejectResultPromise |
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
| #pragma once | |
| #include <algorithm> | |
| #include <utility> | |
| //////////////////////////////////////////////////////////////////////////////////////////////////// | |
| //////////////////// Type Index ///////////////////////////////// | |
| //////////////////////////////////////////////////////////////////////////////////////////////////// | |
| template<typename T, typename... Types> | |
| struct type_index; |
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
| #pragma once | |
| #include <cstddef> | |
| #include <utility> | |
| template<typename T1, typename T2> | |
| class My_Variant { | |
| public: | |
| explicit My_Variant(const T1 &value) : index_(0) { | |
| new(&value_.t1) T1(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
| #include <coroutine> | |
| #include <iostream> | |
| #include <print> | |
| #include <thread> | |
| template<typename T> | |
| struct Generator { | |
| struct promise_type; | |
| explicit Generator(promise_type &promise) : handle(std::coroutine_handle<promise_type>::from_promise(promise)) { |
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 MyPromise = function (executor) { | |
| const PENDING = "Pending"; | |
| const RESOLVED = "Resolved"; | |
| const REJECTED = "Rejected"; | |
| this.state = PENDING | |
| this.val = null; | |
| this.err = null; | |
| const successPromisesCb = []; | |
| const failPromisesCb = []; | |
| this.then = (successCallback) => { |
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
| public class DivideMonad { | |
| static Optional<List<String>> split(String commaSeparatedString) { | |
| final Long commaCount = commaSeparatedString.chars().filter(ch -> (ch == ',')).count(); | |
| if (commaCount != 1) { | |
| return Optional.empty(); | |
| } | |
| String[] splitString = commaSeparatedString.split(","); | |
| return Optional.of(List.of(splitString[0], splitString[1])); | |
| } |
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
| async function hackTypercer(wpm) { | |
| const textSelector =".inputPanel span"; | |
| const timerSelector = ".countdownPopup"; | |
| const inputSelector = "input"; | |
| if (!document.querySelector(timerSelector)) { | |
| return; | |
| } | |
| while (document.querySelector(timerSelector) !== null) { |