This file contains 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
/** | |
* @description given an enum, extracts its values (string) and lets you type-check them. | |
* @example | |
* ```typescript | |
* enum Foo = { | |
* Hello: "a", | |
* World: "b" | |
* } | |
* | |
* const a: ValueOfEnum<Foo> = "a"; // correct |
This file contains 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 { Except, Merge } from "type-fest"; | |
/** | |
* @description Merge `ReplacedProps` in `T`, excluding keys of `ReplacedProps` that are not originally in T. | |
* @example | |
* ```typescript | |
* type FooBar = { foo: string, bar: string } | |
* | |
* type FooBarReplaced = ReplacedProps<FooBar, { bar: number }> | |
* |
This file contains 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
extends: [[spectral:oas, all]] | |
# See description of each at https://meta.stoplight.io/docs/spectral/ZG9jOjExNw-open-api-rules | |
rules: | |
info-contact: off | |
info-license: off | |
license-url: off | |
oas3-api-servers: off | |
oas3-parameter-description: error |
This file contains 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
#!/usr/bin/env bash | |
for topic in $(confluent kafka topic list); | |
do | |
k8s_namespace=$(echo "${topic}" | cut -d. -f1) | |
if [[ $k8s_namespace == slice-* ]] ; then | |
if kubectl get ns "${k8s_namespace}" ; then | |
echo "${k8s_namespace}" exists | |
else | |
confluent kafka topic delete "${topic}" |
This file contains 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
quicksort :: (Ord a) => [a] -> [a] | |
quicksort [] = [] | |
quicksort (x:xs) = | |
let smallerSorted = quicksort (filter (<=x) xs) | |
biggerSorted = quicksort (filter (>x) xs) | |
in smallerSorted ++ [x] ++ biggerSorted |
This file contains 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 minSum(num, k) { | |
console.log(num.length, k); | |
if (!(1 <= num.length && num.length <= Math.pow(10, 5)) || !(k >= 1 && k <= Math.pow(10, 7))) { | |
console.error("Error: input is outside the bounds"); | |
return; | |
} | |
// return minSum_READABLE(num, k); | |
return minSum_FAST(num, k); | |
} |