This file contains hidden or 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
| # In your home directory ~.gitconfig | |
| [user] | |
| name = <your name> | |
| email = <personal-email>@gmail.com | |
| # If all Homebound-related code is in your ~/homebound directory | |
| [includeIf "gitdir:~/homebound/"] | |
| path = .gitconfig-homebound |
This file contains hidden or 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
| const { EnvironmentContext, JestEnvironment } = require("@jest/environment"); | |
| const { LegacyFakeTimers, ModernFakeTimers } = require("@jest/fake-timers"); | |
| const { Config, Global } = require("@jest/types"); | |
| const { ModuleMocker } = require("jest-mock"); | |
| const JestUtil = require("jest-util"); | |
| const { parseHTML } = require("linkedom"); | |
| const VM = require("vm"); | |
| const { Script } = VM; | |
| /** |
This file contains hidden or 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 { $mobx, isObservable, makeObservable } from "mobx"; | |
| const annotationsSymbol = Symbol("annotationsSymbol"); | |
| const objectPrototype = Object.prototype; | |
| /** | |
| * A purposefully-limited version of `makeAutoObservable` that supports subclasses. | |
| * | |
| * There is valid complexity in supporting `makeAutoObservable` across disparate/edge-casey | |
| * class hierarchies, and so mobx doesn't support it out of the box. See: |
This file contains hidden or 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
| type Args = { | |
| id?: string | undefined | null; | |
| firstName?: string | undefined | null; | |
| parentId?: string | undefined | null; | |
| different?: string | undefined | null; | |
| }; | |
| type Opts = { | |
| id?: string | undefined | null; | |
| firstName?: string | undefined | null; |
This file contains hidden or 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
| class Target { | |
| ref = new Ref(); | |
| foo() { | |
| return this.bar(); | |
| } | |
| bar() { | |
| return this.ref; | |
| } | |
| } | |
| class Ref { |
This file contains hidden or 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
| interface AstNode<T> { | |
| value: T; | |
| } | |
| const n1: AstNode<number> = { value: 1 }; | |
| const n2: AstNode<string> = { value: "asdf" }; | |
| // https://github.com/microsoft/TypeScript/pull/26063 says that if T is a tuple | |
| // type, the mapped type will map each specific type in the tuple. | |
| type Values<T> = { [P in keyof T]: T[P] extends AstNode<infer V> ? V : never }; |
This file contains hidden or 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 path from "path"; | |
| import { Polly, PollyConfig } from "@pollyjs/core"; | |
| // @ts-ignore polly's typings aren't great but we don't really need them for this small init code | |
| import { setupPolly } from "setup-polly-jest"; | |
| import { MODES } from "@pollyjs/utils"; | |
| import { env } from "@src/env"; | |
| Polly.register(require("@pollyjs/adapter-node-http")); | |
| Polly.register(require("@pollyjs/persister-fs")); |
This file contains hidden or 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
| class Foo { | |
| a = 1; | |
| b(): void {} | |
| c(): boolean { | |
| return true; | |
| } | |
| } | |
| // https://medium.com/dailyjs/typescript-create-a-condition-based-subset-types-9d902cea5b8c | |
| type FilterFlags<Base, Condition> = { |
This file contains hidden or 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
| ### Keybase proof | |
| I hereby claim: | |
| * I am stephenh on github. | |
| * I am stephenhaberman (https://keybase.io/stephenhaberman) on keybase. | |
| * I have a public key ASBgKUp5p77PdVZdtSABrgJit4xQ9iahkzipyPmQwPAPuQo | |
| To claim this, I am signing this object: |
This file contains hidden or 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
| role1 = { name, perms: [p1, p2, p3] } | |
| role2 = { name, perms: [p3, p4] } | |
| roles = [role1, role2, ...] | |
| # put lists in sorted sort | |
| # O(N_roles * N_permissions log N_permissions) | |
| roles.forEach { sortInPlace(_.perms) } | |
| # compare each role to the other, N^2 = 16m comparison |