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:
# 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; | |
} |
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); |
// ==UserScript== | |
// @name YouTube Link Title | |
// @description Adds video titles, shows previews and embeds on click. Also supported: Vimeo, LiveLeak, Dailymotion, vidme, WorldStarHipHop, Vine, Coub, Streamable | |
// @namespace http://w9p.co/userscripts/ | |
// @version 2017.2.28 | |
// @author kuehlschrank | |
// @homepage http://w9p.co/userscripts/ytlt | |
// @icon https://w9p.co/userscripts/ytlt/icon.png | |
// @include http* | |
// @exclude http*//*.google.*/* |
const arrayMarker = Symbol("sql.array"); | |
export interface ArraySqlReplacement { | |
[arrayMarker]: true; | |
array: any[]; | |
joiner: string; | |
} | |
const isArraySqlReplacement = (value: any): value is ArraySqlReplacement => | |
typeof value === "object" && value !== null && value[arrayMarker]; |
export function* range(start, endExclusive, step) { | |
switch (arguments.length) { | |
case 1: | |
endExclusive = start; | |
start = 0; | |
case 2: | |
step = start > endExclusive ? -1 : 1; | |
} | |
if (start === endExclusive) { |
// 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, |