Legend:
- Rounded corners: needs work to better CMake-ify
- Square corners: ready to be used from CMake
- Penguin: Linux only
- Frog: Available in Conan Center Index
Legend:
function* search(visited, path, object, keys, values) { | |
for (const key of Reflect.ownKeys(object)) { | |
const value = object[key]; | |
if (keys.has(key) || values.has(value)) { | |
yield [path.slice(), value]; | |
} | |
if (typeof value === "object" && value != null && !visited.has(value)) { | |
visited.add(value); |
/** | |
* Explode implementation. The inputs to this function are not validated, use | |
* {@link explode} for inputs that might not meet the requirements. | |
* | |
* @param delimiter Non-empty string | |
* @param string | |
* @param limit Integer in the range of [2 - 4294967295] | |
*/ | |
export function explodeUnchecked( | |
delimiter: string, |
# Path to your LLVM Clang executables, I have mine in the PATH so I just name | |
# them directly | |
set(CMAKE_C_COMPILER clang) | |
set(CMAKE_CXX_COMPILER clang++) | |
# Make sure CMake doesn't do something silly and just tell it that we are | |
# compiling for Windows on Windows | |
set(CMAKE_SYSTEM_NAME Windows) | |
set(CMAKE_CROSSCOMPILING 0) |
template<class T, template<class> class M> | |
[[nodiscard]] constexpr auto | |
fmap(const M<T>& x, auto&& f) | |
noexcept(noexcept(M<decltype(f(*x))>{f(*x)})) | |
-> M<decltype(f(*x))> | |
{ | |
if (x) { | |
return {f(*x)}; | |
} else { | |
return {}; |
function* chunkIterable(iterable, chunkSize) { | |
const it = iterable[Symbol.iterator](); | |
for (let i = 0; i !== -1; ) { | |
const chunk = []; | |
for (const limit = i + chunkSize; i < limit; ++i) { | |
const { done, value } = it.next(); | |
if (done) { | |
i = -1; | |
break; | |
} |
export function* scan(iterable, reducer, initialValue) { | |
const it = iterable[Symbol.iterator](); | |
let accumulator = initialValue; | |
let index = 0; | |
if (arguments.length < 3) { | |
const step = it.next(); | |
if (step.done) { | |
return; | |
} |
async function concurrentWorker(context, callback) { | |
const { queue } = context; | |
const abortToken = Symbol(); | |
while (context.ok) { | |
const { done, value } = queue.next(); | |
if (done) { | |
context.ok = false; | |
return; | |
} |
/* eslint-disable strict, semi, no-empty, no-cond-assign */ | |
/* globals webm, localforage, VanillaModal */ | |
setTimeout(() => { | |
"use strict"; | |
const saucenao = "http://saucenao.com/search.php?db=999&url=", document = window.document, rem = function(b) { | |
clearInterval(webm.timer) | |
clearInterval(webm.updater) | |
document.body.removeEventListener("mouseup", webm.mouseup) | |
if (webm.observer) | |
webm.observer.disconnect() |
// Ideally, Map would have this as a method, but the proposal is still only on | |
// stage 2: https://github.com/tc39/proposal-upsert | |
function emplace<K, V>( | |
map: Map<K, V>, | |
key: K, | |
supplier: (key: K) => V, | |
): V; | |
function emplace<K, V, This>( | |
map: Map<K, V>, | |
key: K, |