Skip to content
View index.js
const flatMapLatest = (fn, stream) =>
stream.publish(s => s.flatMap(v => fn(v).takeUntil(s)));
const flatMapLatest = (fn, stream, resultSelector) => stream.publish(s => {
return s.flatMap(v => fn(v).map(v2 => resultSelector(v, v2)).takeUntil(s));
});
const delay = (source, delay) => source.flatMap(e => Rx.Observable.timer(delay).mapTo(e))
const debounceTime = (time, stream) => flatMapLatest(v => of(v).delay(time), stream);
View index.html
<!DOCTYPE html>
<html>
<head>
<script src="http://d3js.org/d3.v3.min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/rxjs/2.3.22/rx.all.js"></script>
<meta charset="utf-8">
<title>JS Bin</title>
<style id="jsbin-css">
body {
font-family: Sans-serif;
View gist:83b187124cfb9adca453320ae3e513a2

Intro

Kotlin is a new programming language for the JVM. It produces Java bytecode, supports Android and generates JavaScript. The latest version of the language is Kotlin M5.3

Kotlin project website is at kotlin.jetbrains.org.

All the codes here can be copied and run on Kotlin online editor.

Let's get started.

View signal.js
function Signal(sub) {
this.sub = sub;
}
Signal.prototype = {
/**
* Applies the given function over each event.
*/
map: function(fn) {
var sub = this.sub;
View countdown.rx.js
const now = moment();
const end = now.clone().add(2, 'minutes');
const diff = (end - now) / 1000;
const tick$ = Rx.Observable.timer(0,1000)
.scan((acc) => {
return acc - 1;
}, diff)
.take(diff);
View _usage.js
//Some fantasy implementations
const Just = require('./just')
const Cant = require('./cant')
const List = require('./list')
//Spec file that defines what arguments are used for type identification
const fantasy = require('./fantasy')
//The magic.
const {chain, map, index} = require('../../src/xface')(fantasy, [Just, Cant])
View rxjs_operators_by_example.md

RxJS 5 Operators By Example

A (soon to be) complete list of RxJS 5 operators with easy to understand explanations and runnable examples.

(I will be adding one operator per day until all operators are included.)

Table of Contents

View webpack.config.js
const path = require('path');
const BrowserSyncPlugin = require('browser-sync-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const NgAnnotatePlugin = require('ng-annotate-webpack-plugin');
const ProgressBarPlugin = require('progress-bar-webpack-plugin');
const webpack = require('webpack');
const AUTOPREFIXER_BROWSERS = [
'Android 2.3',
View ranges.js
const range1 = len => Object.keys(new Int8Array(len)).map(parseFloat);
const range2 = len => Array.apply(null, {length: len}).map(Number.call, Number);
const range3 = (start, end) => Array.apply(null, Array(end - start)).map((_, i) => start + i);
const range4 = (start, end) => [...Array(end - start)].map((_, i) => start + i);
const range5 = len => Object.keys(Array.apply(null, Array(len)));
Something went wrong with that request. Please try again.