/** @see microsoft/WSL#1724 (comment) */
if test -t 1; then
zsh
fi
type Some<T> = { some: T, none: false }; | |
type None = { some: undefined, none: true }; | |
type Option<T = unknown> = Some<T> | None; | |
type InferredSome<T extends Option> = T extends Some<infer R> ? | |
R : | |
never; | |
type OptionResult<T = unknown> = T extends null | undefined ? None : Some<T>; |
#!/bin/sh | |
# Ensure a reelase tag is provided | |
if [ -z "$1" ]; then | |
printf "Please provide a release tag!\n" | |
exit 1 | |
fi | |
RELEASES=$(gh release list --limit 1) |
class Node { | |
constructor(value) { | |
this.prev = null; | |
this.next = null; | |
this.value = value; | |
} | |
} | |
class MRU { | |
constructor(size) { |
// a = 1; b = a - 1; b = b - 100; b * a - 100 | |
// split('; '); | |
// a=1 | |
// b=a-1 | |
// b=b-100 | |
// b*a-100 | |
// a=1 | |
// a 1 = |
function tryParseUrl(url) { | |
try { | |
const u = new URL(url); | |
return u; | |
} catch (error) { | |
console.error(error); | |
return ''; | |
} | |
} |
/** @see microsoft/WSL#1724 (comment) */
if test -t 1; then
zsh
fi
function findSmallestSum(arr) { | |
const len = arr.length; | |
if (!len) return 0; | |
if (len === 1) return arr[0]; | |
if (len === 2) return arr[0] + arr[1]; | |
// f - first, s - second | |
let [f, s] = arr; | |
let sum = f + s; |
{ | |
"workbench.colorCustomizations": { | |
"editor.selectionBackground": "#2179775c", | |
"editor.background": "#0a0a0a" | |
}, | |
"workbench.colorTheme": "Firefox Quantum Dark" | |
} |
// Time complexity: O(n) where n is the number of characters. | |
// Space complexity: O(1) for a few variables. | |
function alternatingCharacters(x) { | |
const len = x.length; | |
if (len < 2) return 0; | |
let lastChar = x[0]; | |
let count = 0; | |
let countA = lastChar === 'a' ? 1 : 0; |