Skip to content

Instantly share code, notes, and snippets.

import withReadme from 'storybook-readme/with-readme';
import readme from './README.md';
const decorateDocs = (...documentation) => (story, context) =>
withReadme(documentation, () => story())(context);
storiesOf(...)
.addDecorator(decorateDocs(readme))
...
@bholloway
bholloway / roundToBinary.js
Created October 11, 2016 00:43
Ceiling function for a value to nearest binary of N-terms
/**
* Ceiling function for a value to nearest binary of N-terms.
* For `N = 1` allows maximums such as `128`, `256`, etc.
* For `N = 2` allows maximums such as `96`, `384`, etc.
*
* @param {number} [numTerms] Optional number of terms
* @returns {function} Math.ceil for a value to nearest binary of N-terms
*/
const roundToBinary = (numTerms = 1) => value => {
@bholloway
bholloway / index.js
Created April 14, 2016 06:09
requirebin sketch
require('console-log-div');
var Rx = require('rxjs');
var subject = new Rx.BehaviorSubject(undefined);
var stimulus = new Rx.Subject(),
countObs = Rx.Observable.never()
.multicast(stimulus)
.refCount()
@bholloway
bholloway / index.html
Created February 14, 2016 09:38 — forked from anonymous/index.html
JS Bin // source https://jsbin.com/jelane
<!DOCTYPE html>
<html>
<head>
<script src="http://fb.me/react-0.13.1.js"></script>
<script src="http://fb.me/react-with-addons-0.13.1.js"></script>
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body>
@bholloway
bholloway / index.js
Last active January 19, 2016 12:33
requirebin sketch
var Rx = require('rxjs');
// -------------------- A : complete then subscribe : PASS --------------------------------
// get an observable similar to how we would create a data source
var stimulusA;
var isDisposedA = false;
var commonA = Rx.Observable.create(function (instance) {
stimulusA = instance;
})
var sourceA = Rx.Observable.defer(function () {
@bholloway
bholloway / index.js
Last active January 19, 2016 12:06
requirebin sketch
var Rx = require('rxjs');
// -------------------- A : complete then subscribe : FAIL --------------------------------
// get an observable similar to how we would create a data source
var stimulusA;
var sourceA = Rx.Observable.create(function (instance) {
stimulusA = instance;
})
.publish()
.refCount();
@bholloway
bholloway / index.html
Last active January 14, 2016 07:23 — forked from anonymous/index.html
RxJS cold behaviour subject RxJS cold behaviour subject // source http://jsbin.com/golani
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="RxJS cold behaviour subject">
<meta charset="utf-8">
<title>RxJS cold behaviour subject</title>
<script src="https://npmcdn.com/@reactivex/[email protected]/dist/global/Rx.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/q.js/1.0.1/q.js"></script>
</head>
<body>
@bholloway
bholloway / index.html
Created December 5, 2015 02:33 — forked from anonymous/index.html
rxjs behaviour subject rxjs behaviour subject // source https://jsbin.com/hovada
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="rxjs behaviour subject">
<meta charset="utf-8">
<title>rxjs behaviour subject</title>
</script>
<script src="https://npmcdn.com/@reactivex/[email protected]/dist/global/Rx.js"></script>
</head>
<body>
@bholloway
bholloway / index.html
Created December 4, 2015 11:11 — forked from anonymous/index.html
rxjs delayed subscriber with default rxjs delayed subscriber with default // source https://jsbin.com/panela
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="rxjs delayed subscriber with default">
<meta charset="utf-8">
<title>rxjs delayed subscriber with default</title>
</script>
<script src="https://npmcdn.com/@reactivex/[email protected]/dist/global/Rx.js"></script>
</head>
<body>
@bholloway
bholloway / index.html
Created December 4, 2015 06:19 — forked from anonymous/index.html
Angular 1.x RxJS test Angular 1.x RxJS test // source https://jsbin.com/cequwu
<!DOCTYPE html>
<html ng-app="app">
<head>
<script src="https://code.jquery.com/jquery-2.1.4.js"></script>
<meta name="description" content="Angular 1.x RxJS test">
<script src="https://npmcdn.com/@reactivex/[email protected]/dist/global/Rx.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.0/angular.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular-ui-router/0.2.15/angular-ui-router.js"></script>
<meta charset="utf-8">
<title>Angular 1.x RxJS test</title>