This file contains hidden or 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 Box { | |
| constructor(x) { this._x = x } | |
| map(f) { return new Box(f(this._x)) } | |
| } | |
| class LazyBox { | |
| constructor(g) { this.g = g } | |
| map(f) { return new LazyBox(() => f(this.g())) } | |
| } |
This file contains hidden or 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
| /** | |
| waitLatestFrom(...sources, [selector]) | |
| Like withLatestFrom but waits for all sources to produce at least one value | |
| before emitting. Emits immediately once it has a value for all sources. After | |
| that it actively collects the latest emission from the other source observables | |
| in the background and emits the latest collected values whenever the primary | |
| source emits -- like withLatestFrom. | |
| If the primary source completes, the other sources will be completed as well. |
This file contains hidden or 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
| #!/usr/bin/env python | |
| # coding: utf-8 | |
| ''' | |
| Validate input file(s) against a Voluptuous schema | |
| Pass a dash to read from stdin. | |
| ''' | |
| from __future__ import print_function | |
| import imp |
This file contains hidden or 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 { TimeoutError, timer } from 'rxjs' | |
| import { AjaxTimeoutError } from 'rxjs/ajax' | |
| import { | |
| delay, | |
| filter, | |
| flatMap, | |
| repeatWhen, | |
| retryWhen, | |
| scan, | |
| timeout, |
This file contains hidden or 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
| include: | |
| - git | |
| apache: | |
| pkg.installed: | |
| - name: httpd | |
| service.running: | |
| - name: httpd | |
| - enable: True |
This file contains hidden or 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
| var Actions = new Rx.Subject(); | |
| Actions.onCompleted = () => {}; // never complete | |
| var act = (tag, data = {}) => ({tag, data}); | |
| var send = tag => data => Actions.onNext(act(tag, data)); | |
| var Dispatcher = Actions.asObservable(); | |
| // ---------------------------------------------------------------------------- | |
| var C = constants = { | |
| GET_USER: 'get_user', |
This file contains hidden or 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
| /** | |
| Misc collection of shorthand helper functions for Flux implemented with Rx | |
| **/ | |
| import Rx from 'rx'; | |
| import _ from 'lodash'; | |
| import formSerialize from 'form-serialize'; | |
| Rx.Observable.prototype.byTag = byTag; |
This file contains hidden or 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
| // Central xhr progress tracker. Used for both a global | |
| // activity indicator as well as granular spinners within in a page. | |
| var Progress$ = new Rx.Subject(); | |
| // Make an xhr call and make a tag to track the progress ticks. | |
| var users$ = Rx.DOM.ajax({ | |
| method: 'GET', | |
| url: 'https://api.github.com/users', | |
| responseType: 'json', | |
| progressObserver: Rx.Observer.create( |
This file contains hidden or 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
| /** | |
| Proof-of-concept server-sent events HTTP server using Node.js and RxJS | |
| Open http://localhost:8000 in a browser and view the console. | |
| **/ | |
| var http = require('http'), | |
| https = require('https'); | |
| var Rx = require('rx'); |
This file contains hidden or 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
| # Only required on Python 2 | |
| futures==3.0.3 | |
| tornado==4.3 |