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
abstract class Model { | |
cuack(m:string):void { | |
console.log("Hey", m); | |
} | |
} | |
class Result { | |
getModelType<c extends Model>(type:{new():c}, p:string):c { | |
return new type(); | |
} |
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
package main | |
import ( | |
"fmt" | |
"log" | |
"net/http" | |
"time" | |
) | |
// type Limiter struct { |
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
localhost:2000 | |
tls self_signed | |
gzip | |
rewrite { | |
to {path} {path}/ /index.html | |
} | |
root ./dist |
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
.update(t, () => ngZone.run(() => { | |
obs.next(t); | |
obs.complete(); | |
})); |
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
function getProfile(idToken: string): Observable<any> { | |
return new Observable(observer => { | |
auth0.getProfile(idToken, (err, profile) => { | |
if (err) { | |
observer.error(err); | |
} | |
else { | |
observer.next(profile); | |
observer.complete(); | |
} |
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 { | |
ElementRef, | |
NgZone, OnInit, OnDestroy | |
} from '@angular/core'; | |
import { Subject } from 'rxjs/Subject'; | |
import { Observable } from 'rxjs/Observable'; | |
import 'rxjs/add/observable/fromEvent'; | |
import 'rxjs/add/operator/debounceTime'; | |
import 'rxjs/add/operator/takeUntil'; |
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
ramfs: | |
rm -r tmp | |
mkdir tmp | |
sudo mount -t tmpfs -o size=512m tmpfs ./tmp | |
clean: | |
rm -r tmp/* | |
rm dist/build.js |
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
this.http.get('./country-info/' + country + '.json') | |
.retryWhen(error$ => | |
error$.switchMap(err => navigator.onLine ? timer(1000) : fromEvent(document, 'online')) // ONE LINE ADDED | |
.map((res: Response) => res.json()) | |
.subscribe(res => this.capitol = res.capitol); |
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 { | |
Directive, Input, ElementRef, Output, | |
Renderer, OnInit, HostListener, EventEmitter | |
} from '@angular/core'; | |
export interface SortResult { | |
from: number; | |
to: number; | |
} |
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
function fakePromise(delay: number, val:number): Promise<number> { | |
return new Promise((resolve, reject) => { | |
setTimeout(() => { | |
console.log('Promise resolved', val); | |
resolve(val); | |
}, delay); | |
}); | |
} |