This file contains 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
var fallback = require('express-history-api-fallback'); | |
var express = require('express'); | |
var compress = require('compression'); | |
var app = express(); | |
var root = __dirname + '/dist'; | |
app.use(compress()); | |
app.use(express.static(root)); | |
app.use(fallback('index.html', { root: root })); |
This file contains 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 } from '@angular/core'; | |
import { Subject } from 'rxjs/Subject'; | |
@Injectable() | |
export class AppStateService { | |
changes: Subject<any> = new Subject(); | |
private state: any = {}; | |
private history: any[] = []; | |
private historyPos: number = 0; |
This file contains 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
// Standard Service Class | |
export class MyService { | |
constructor(private config) { } | |
} | |
// factory for creating new instances of the service | |
function createMyService(config = {}) { | |
return new MyService(config); | |
} |
This file contains 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
// https://github.com/deebloo/rxjs-worker | |
var observable = Observable.of([0, 1, 2, 3, 4]); | |
observable | |
.map(function (data) { | |
return data.concat([5, 6, 7, 8, 9]); | |
}) | |
.workerMap(function (data) { | |
return data.concat([10,11,12,13,14]);; | |
}) |
This file contains 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 core testing libs | |
import { | |
beforeEach, | |
addProviders, | |
it, | |
describe, | |
expect, | |
inject | |
} from '@angular/core/testing'; |
This file contains 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 } from 'redux'; | |
const add1 = () => { | |
type: 'ADD1', | |
payload: state => [{}, ...state] | |
} | |
const add2 = () => { | |
type: 'ADD2', | |
payload: state => add1().payload(add1().payload(state)) |
This file contains 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
// Our compose function that can be used as a decorator | |
// Decorators are just functions | |
const Compose = (mixins: any[]) => { | |
const protos = mixins.map(mixin => mixin.prototype) | |
const targetFunc = target => { | |
Object.assign(target.prototype, ...protos) | |
} | |
targetFunc.create = (base: any) =>{ |
This file contains 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 { Component, Input } from '@angular/core'; | |
@Component({ | |
selector: 'sweet-modal', | |
styleUrls: ['sweet-modal.component.css'] | |
templateUrl: 'sweet-modal.component.html' | |
}) | |
export class LsModalComponent { | |
@Input() width: string = '400px'; |
This file contains 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
export interface CustomElementConfig { | |
tagName: string; | |
options?: { | |
extends: string; | |
}; | |
} | |
/** | |
* @CustomElement({ | |
* tagName: 'my-element' |
This file contains 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 { Component, ViewChild, ElementRef, AfterViewInit } from '@angular/core'; | |
@Component({ | |
selector: 'my-app', | |
template: ` | |
<div class="map-container" #mapContainer><div> | |
`, | |
styles: [` | |
.map-container { | |
height: 300px; |