Skip to content

Instantly share code, notes, and snippets.

View sielay's full-sized avatar

Łukasz Marek Sielski sielay

View GitHub Profile
@Brooooooklyn
Brooooooklyn / ChunkUploader.ts
Created December 21, 2016 13:10
RxJS file uploader demo
import { Fetch, Utils } from 'teambition-sdk'
import { Observable } from 'rxjs/Observable'
import { Subject } from 'rxjs/Subject'
import { ReplaySubject } from 'rxjs/ReplaySubject'
import { AjaxResponse } from 'rxjs/observable/dom/AjaxObservable'
import { Subscriber } from 'rxjs/Subscriber'
import * as config from 'config'
export interface ChunkMeta {
fileType: string
@Stuk
Stuk / promise-debug.js
Last active October 2, 2016 21:39
I've found this code useful for debugging promises, to find what order things are happening in. `console.error` gives a stack trace in the Webkit Developer Tools which makes easily narrow down where the promise creation and resolution is happening.
var Q = require("q");
var Set = require("collections/set"); // https://npmjs.org/package/collections
window.outstandingPromises = new Set();
var originalDefer = Q.defer;
Q.defer = function () {
console.error("Deferred created");
var deferred = originalDefer();
deferred.stack = new Error("").stack;
window.outstandingPromises.add(deferred);
@keeguon
keeguon / countries.json
Created April 5, 2012 11:11
A list of countries in JSON
[
{name: 'Afghanistan', code: 'AF'},
{name: 'Åland Islands', code: 'AX'},
{name: 'Albania', code: 'AL'},
{name: 'Algeria', code: 'DZ'},
{name: 'American Samoa', code: 'AS'},
{name: 'AndorrA', code: 'AD'},
{name: 'Angola', code: 'AO'},
{name: 'Anguilla', code: 'AI'},
{name: 'Antarctica', code: 'AQ'},