Skip to content

Instantly share code, notes, and snippets.

@jondejong
jondejong / processchaining.js
Created February 10, 2016 22:49
A simple, if ugly, approach to promise chaining
var things = [
//...Array of things to process...
];
var methodThatReturnsPromise() = function {
// Must be executed on all the things
// In order
// return a promise
};
@jondejong
jondejong / HttpService.ts
Created June 2, 2016 20:13
Angular 2 HttpService example for URL prefixes and auth headers
@Injectable()
export class HttpService {
private urlRoot:String;
constructor(private _http: Http,
private userService:UserService) {
this.urlRoot = 'https://api.myapp.com';
if(host == 'localhost'){
this.urlRoot = 'http://localhost:4040';