Skip to content

Instantly share code, notes, and snippets.

View MikeRyanDev's full-sized avatar

Mike Ryan MikeRyanDev

View GitHub Profile
@MikeRyanDev
MikeRyanDev / cla.md
Created May 9, 2025 18:46
CLA for Hashbrown

Hashbrown Contributor License Agreement

Thank you for considering contributing to Hashbrown! To keep our project healthy and easy to share, we ask all contributors to agree to the following terms.

Definitions

  • You – the individual or legal entity (and its affiliates) making a contribution.
  • Hashbrown – the open-source framework maintained by LiveLoveApp, including all related repositories.
  • Contribution – any work you submit to Hashbrown (code, documentation, tests, issue reports, design assets, etc.).
  • Submitted – conveyed to Hashbrown via pull requests, commits, issues, mail, or any other communication.
@MikeRyanDev
MikeRyanDev / app.component.ts
Created June 25, 2024 02:16
Signal Store Reactivity Example
import {
AfterViewInit,
Component,
ElementRef,
inject,
viewChild,
} from '@angular/core';
import {
signalStore,
withEffects,
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 115 32 168 255 255 92 32 56 32 255 255 255
255 255 255 32 32 32 115 255 32 69 59 44 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
import { Observable, Observer } from 'rxjs';
import { createSelector, MemoizedSelector } from '@ngrx/store';
import { createEntityAdapter } from '@ngrx/entity';
export interface View<T> extends Observable<T> {
isView: true;
release(): void;
}
export interface Value<T> extends View<T> {

First you have to define the scalar type in the GraphQL schema:

scalar Date

Then you have to provide a resolver for the scalar type. Here's an example implementation using Luxon:

import { DateTime } from 'luxon';

makeExecutableSchema({
export class BookEffects {
@Effect() deleteBook$ = this.action$.pipe(
ofType(INPUT_ACTION_TYPE),
mergeMap(action => this.bookService.deleteBook(action.bookId)),
);
}
export class BookEffects {
@Effect() updateBook$ = this.actions$.pipe(
ofType(INPUT_ACTION_TYPE),
groupBy(
action => action.bookId,
action => action,
action$ => action$.pipe(
timeoutWith(15000, Observable.empty()),
ignoreElements(),
),
export class BookEffects {
@Effect() getOneBook$ = this.action$.pipe(
ofType(INPUT_ACTION_TYPE),
groupBy(
action => action.bookId,
action => action.bookId,
bookId$ => bookId$.pipe(
timeoutWith(15000, Observable.empty(),
ignoreElements(),
),
groupBy(
/**
* Select groups by their `bookId`
*/
action => action.bookId,
/**
* Map each action to the `bookId` for convenience
*/
action => action.bookId,
/**
export class BookEffects {
@Effect() getOneBook$ = this.actions$.pipe(
// Step 1 Type: Observable<InputActionType>
ofType(INPUT_ACTION_TYPE),
// Step 2 Type: Observable<Observable<InputActionType>>
groupBy(action => action.bookId),
// Step 3 Type: Observable<Observable<BookModel>>,
map(action$ => action$.pipe(
exhaustMap(action => this.bookService.getOne(action.bookId),
)),