Skip to content

Instantly share code, notes, and snippets.

View maxime1992's full-sized avatar

Maxime maxime1992

View GitHub Profile
#!/bin/bash
# Error handling
function OwnError()
{
echo -e "[ `date` ] $(tput setaf 1)$@$(tput sgr0)"
exit $2
}
# Repository for rethinkdb
@btroncone
btroncone / ngrxintro.md
Last active February 9, 2024 15:37
A Comprehensive Introduction to @ngrx/store - Companion to Egghead.io Series

Comprehensive Introduction to @ngrx/store

By: @BTroncone

Also check out my lesson @ngrx/store in 10 minutes on egghead.io!

Update: Non-middleware examples have been updated to ngrx/store v2. More coming soon!

Table of Contents

@btroncone
btroncone / rxjs_operators_by_example.md
Last active July 16, 2023 14:57
RxJS 5 Operators By Example

@ngrx/store v3

Problems:

  • Users want to compose reducer tree across modules
  • Idea of a single reducer function makes it difficult for the library to dynamically augment the shape of the state tree
  • Turning control over to the library to build the root reducer limits the use of meta-reducers
  • Feature modules may inadvertently collide with the state of the root module
  • Library authors may want to leverage @ngrx/store in their projects and provide an easy way
@Injectable()
export class NgrxStoreService {
ondestroy$: Observable<void> = new Subject<void>();
constructor(protected store: Store<State>, protected changeDetector: ChangeDetectorRef) { }
select<R>(mapFunc: (state: State) => R): Observable<R> {
return this.store.select(mapFunc).pipe(
takeUntil(this.ondestroy$),

[Know about it][Understanding][Clear understanding]

NOVICE

CONCEPTS

  • xxx Immutable Data
  • xxx Second-Order Functions
  • xxx Constructing & Destructuring
  • xxx Function Composition
  • xxx First-Class Functions & Lambdas
import { EntityAdapter, EntityState } from '@ngrx/entity';
import { ActionReducer } from '@ngrx/store';
import { CommandReducer, ReducerCommand } from 'ngrx-command-reducer';
import { BaseAction, StaticAction } from './base.actions';
type PayloadActionFunction<S, P> = (p: P, s: S) => S;
type PayloadlessActionFunction<S> = (s: S) => S;
export type EntityFunction<S, P> = PayloadActionFunction<S, P> | PayloadlessActionFunction<S>;
export class EntityCommandReducer<Entity, State extends EntityState<Entity>, Action extends BaseAction> {
@michaelbromley
michaelbromley / create-mock.ts
Last active December 6, 2019 11:36
Automatic component mocking in Angular
import {Component, EventEmitter, Type} from '@angular/core';
type MetadataName = 'Input' | 'Output';
interface PropDecoratorFactory {
ngMetadataName: MetadataName;
bindingPropertyName: string | undefined;
}
interface PropMetadata { [key: string]: PropDecoratorFactory[]; }
@Allov
Allov / Dutch.md
Last active April 6, 2024 08:05
Règles du jeu Dutch

Dutch

Dutch

Le jeu Dutch se joue avec des cartes à jouer standards, sans les jokers. Il est recommandé de jouer avec deux paquets, soit 104 cartes.

Nombre de joueur: 2 à 10

Temps approximatif d'une partie: 30 minutes

@telenieko
telenieko / a_enable_wireless.sh
Created March 5, 2018 16:57
Sample files to enable wireless on Debian initramfs
#!/bin/sh
# this goes into /etc/initramfs-tools/scripts/init-premount/a_enable_wireless
PREREQ=""
prereqs()
{
echo "$PREREQ"
}
case $1 in
prereqs)