Skip to content

Instantly share code, notes, and snippets.

View timkinnane's full-sized avatar

Tim Kinnane timkinnane

View GitHub Profile
@timkinnane
timkinnane / fp-util-types.ts
Last active February 14, 2023 16:42
Typescript Generic Utils for Functional Programming
/**
* Make all optional except given keys.
* @example
* type ABC = { a: any, b: any, c: any }
* type OnlyAB = Only<ABC, 'a' | 'b'>
* // ☝️ OnlyAB = { a, b, c? }
*/
export type Only<T, K extends keyof T> = Partial<T> & Required<Pick<T, K>>
/**
@timkinnane
timkinnane / construct.ts
Created March 16, 2022 05:23
AWS CDK SSM: A construct for accessing SSM values from a stack as Cloud Formation tokens to resolve on deploy.
import { Construct } from 'constructs'
import { aws_ssm as SSM } from 'aws-cdk-lib'
/**
* Create a resource for accessing SSM values (as Cloud Formation tokens to resolve on deploy).
*/
export class ParamsConstruct extends Construct {
private configPath: string
private secretPath?: string
@timkinnane
timkinnane / README.md
Last active August 11, 2024 22:29
Apply branch name format check on commits

Enforce branch name conditions with git hooks

The pre-commit git hook tests branch name against a text pattern.

If commits don't match the pattern, they will error and contributors will have the opportunity to rename the branch before trying to commit again.

Patterns

The example pattern ensures branch names are:

  • scoped by type of change and team owner
@timkinnane
timkinnane / .zshrc
Created September 25, 2022 04:45
Shell alias for PNPM install, including workspace filters.
alias p="pnpm add"
alias pf="pnpm add --filter"
alias pd="pnpm add -D"
alias pdf="pnpm add -D --filter"
alias pi="pnpm i"