Skip to content

Instantly share code, notes, and snippets.

View messaoudi-mounir's full-sized avatar

Messaoudi Mounir messaoudi-mounir

View GitHub Profile
@messaoudi-mounir
messaoudi-mounir / Context.Service.ts
Created July 8, 2021 14:33 — forked from dmorosinotto/Context.Service.ts
Angular Context.Service used to share data (aka state) across components - It's a "dynamic reactive DI" - sample usage: https://stackblitz.com/edit/angular-context-service
import { Injectable, OnDestroy, Optional, SkipSelf } from "@angular/core";
import { Observable, Observer, BehaviorSubject, Subject } from "rxjs";
import { takeUntil, filter } from "rxjs/operators";
import { InjectionToken } from "@angular/core";
@Injectable()
export class ContextService implements OnDestroy {
constructor(@Optional() @SkipSelf() private _parent?: ContextService) {}
private _destroy$ = new Subject<void>();
@messaoudi-mounir
messaoudi-mounir / 0_reuse_code.js
Created October 26, 2013 13:35
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console