Skip to content

Instantly share code, notes, and snippets.

@assainov
assainov / Result.ts
Last active November 18, 2024 14:41
Result type in TypeScript
type Success<T> = { isSuccess: true; data: T};
type Failure<E> = { isSuccess: false; error: E };
export type Result<T, E> = Success<T> | Failure<E>;
export const result = {
succeed<T>(data: T) {
return { isSuccess: true, data } as Success<T>;
},
fail<E>(error: E) {
@assainov
assainov / gist:90ae9db0cda8fe3f2d4895aa83237a56
Created May 12, 2019 10:04 — forked from dznz/gist:64a34466f44d1a335e75
Extract the filename from a path in Excel or Google spreadsheet
=TRIM(RIGHT(SUBSTITUTE(A1,"/",REPT(" ",100)),99))
<div id="root"></div>