- 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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <h1>Angular 2 Recursive List</h1> | |
| <ul> | |
| <ng-template #recursiveList let-list> | |
| <li *ngFor="let item of list"> | |
| {{item.title}} | |
| <ul *ngIf="item.children.length > 0"> | |
| <ng-container *ngTemplateOutlet="recursiveList; context:{ $implicit: item.children }"></ng-container> | |
| </ul> | |
| </li> | |
| </ng-template> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| .composite-title, .composite-title, .vs-dark .monaco-workbench>.activitybar>.content { | |
| background-color: rgba(40, 44, 52, 1) !important; | |
| } | |
| .tabs-container, .tab, .tab.active, .title-actions, .tablist, .tabs-container, .tabs, .composite.title { | |
| background-color: rgba(40, 44, 52, 1) !important; | |
| } | |
| .tab.active, .tab { | |
| border-right: 0px !important; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import {Injectable, NgModuleFactory, NgModuleFactoryLoader, Compiler, Type} from '@angular/core'; | |
| class LoaderCallback { | |
| constructor(public callback) {} | |
| } | |
| export let load: Type = (callback: Function) => { | |
| return new LoaderCallback(callback); | |
| }; |
A complete list of RxJS 5 operators with easy to understand explanations and runnable examples.
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * S-expression parser | |
| * | |
| * Recursive descent parser of a simplified sub-set of s-expressions. | |
| * | |
| * NOTE: the format of the programs is used in the "Essentials of interpretation" | |
| * course: https://github.com/DmitrySoshnikov/Essentials-of-interpretation | |
| * | |
| * Grammar: | |
| * |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { createStore, applyMiddleware } from 'redux'; | |
| import { Observable, Subject } from 'rxjs'; | |
| const api = type => { | |
| console.log(`calling API ${type}`); | |
| return new Promise(res => setTimeout(() => res(), 500)); | |
| }; | |
| const actionOrder = (actions, order) => actions.every((action, index) => action.type === order[index]); | |
| const actionPredicate = actions => filterableAction => actions.some(action => action === filterableAction.type); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function logClass(target: any) { | |
| // save a reference to the original constructor | |
| var original = target; | |
| // a utility function to generate instances of a class | |
| function construct(constructor, args) { | |
| var c : any = function () { | |
| return constructor.apply(this, args); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy) | |
| BSD License | |
| """ | |
| import numpy as np | |
| # data I/O | |
| data = open('input.txt', 'r').read() # should be simple plain text file | |
| chars = list(set(data)) | |
| data_size, vocab_size = len(data), len(chars) |