Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View briancavalier's full-sized avatar

Brian Cavalier briancavalier

  • Pittsburgh
View GitHub Profile
import { tap, take, skip, concat, fromArray, runEffects } from '../packages/core/src/index'
import { newDefaultScheduler } from '../packages/scheduler/src/index'
import { EventEmitter } from 'events'
import multicastStream from '@most/multicast'
import { fromEvent } from 'most'
const emitter = new EventEmitter()
const scheduler = newDefaultScheduler()
const observe = (f, stream) => runEffects(tap(f, stream), scheduler)
@briancavalier
briancavalier / esnextbin.md
Created February 9, 2017 14:12
esnextbin sketch
@briancavalier
briancavalier / esnextbin.md
Last active December 28, 2016 15:09
esnextbin sketch
@briancavalier
briancavalier / esnextbin.md
Last active December 9, 2016 23:48
esnextbin sketch
@briancavalier
briancavalier / esnextbin.md
Created December 5, 2016 00:39
esnextbin sketch
@briancavalier
briancavalier / esnextbin.md
Last active November 17, 2016 13:35
esnextbin sketch
@briancavalier
briancavalier / example.js
Last active May 26, 2018 18:25
Convert node async functions into most.js streams
import { readFile } from 'fs'
// Create a stream-returning version of fs.readFile
const readFileS = fromNode(readFile)
// Use it to create a stream containing the files contents
// map(String) to convert Buffer to string
const s = readFileS('./a/file.txt').map(String)
// Observe the contents
@briancavalier
briancavalier / stream.js
Created June 1, 2016 22:50
Fun with generators as infinite (synchronous) streams
function * empty() {}
function * cons (a, stream) {
yield a
yield * stream
}
function * concat (xs, ys) {
yield * xs
yield * ys
@briancavalier
briancavalier / esnextbin.md
Created May 26, 2016 17:37
esnextbin sketch
@briancavalier
briancavalier / babel-6-markdown-doctest-error.txt
Created May 11, 2016 11:52
Error from most.js `npm test` using babel 6 and markdown-doctest
$ npm test
> most@0.19.3 test /Users/brian/Projects/cujojs/most
> eslint . && buster-test && npm run doctest
186 tests, 347 assertions, 1 runtime ... OK
> most@0.19.3 doctest /Users/brian/Projects/cujojs/most
> markdown-doctest