Skip to content

Instantly share code, notes, and snippets.

View matttelliott's full-sized avatar
👋
Hi!

Matt T Elliott matttelliott

👋
Hi!
View GitHub Profile

I'm working on a weight lifting app and I want to strictly define the way that weights can be added to a set. there can be dumbbell exercises, barbell exercises, or bodyweight exercises, but I'm not lifting dumbbells and barbells a the same time.

export type BodyWeight = {
  /* `weightInLbsBody` is required for all types. I always weigh something.   */
  readonly weightInLbsBody: number
  readonly weightInLbsLeft?: null
@matttelliott
matttelliott / gatsby-gists-list-component.md
Created January 25, 2022 19:54
Add a list of most recent github gists to a gatsby site

Add list of gists to gatsby theme

gatsby-config.js

{
@matttelliott
matttelliott / add-gists-to-github-profile.md
Last active January 25, 2022 02:38
Add Gists to GitHub Profile

In Angular it is often convenient to treat component lifecycle events os observable streams instead of component methods (they are events, after all).

in order to accomplish this, we often find outselves doing something like

export class MyComponent implements OnInit {
  private readonly ngOnInit$ = new ReplaySubject<void>(1)

  public ngOnInit(): void {
@matttelliott
matttelliott / generic-actions.md
Last active January 10, 2022 21:23
Generic component actions

Say we have a bunch of components that emit a stream of ngrx actions

class MyComponent {
  @Output()
  public readonly action$: Observable<Action>
}

Each component emits its own specific actions. Instead of the generic Action,