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
view: Array<number> = []; | |
constructor(private media: ObservableMedia) {} | |
ngOnInit() { | |
this.media.asObservable() | |
.pipe(takeUntil(this.ngUnsubscribe)) | |
.subscribe((change: MediaChange) => { | |
this.changeGraphSize(); | |
}); | |
this.changeGraphSize(); | |
} |
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
class myComponent { | |
private destroyed$: ReplaySubject<boolean> = new ReplaySubject(1); | |
constructor( | |
private serviceA: ServiceA, | |
private serviceB: ServiceB, | |
private serviceC: ServiceC) {} | |
ngOnInit() { | |
this.serviceA | |
.takeUntil(this.destroyed$) | |
.subscribe(...); |
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
// | |
// Array related functions | |
// | |
function eliminateDuplicates(arr) { | |
var i, | |
len=arr.length, | |
out=[], | |
obj={}; |
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
// | |
// Date related functions | |
// | |
function isLeapYear(year) { | |
return (year % 400 == 0) || (year % 4 == 0 && year % 100 != 0); | |
} | |
function getLastDay(year, month) { | |
var new_year = year; |
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
/** | |
* System configuration for Angular 2 app | |
* Reference: https://github.com/angular/quickstart | |
*/ | |
(function (global) { | |
System.config({ | |
paths: { | |
// paths serve as alias | |
'lib:': 'libs/js/' | |
}, |