Skip to content

Instantly share code, notes, and snippets.

Brian Cavalier briancavalier

Block or report user

Report or block briancavalier

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@briancavalier
briancavalier / example.js
Last active May 26, 2018
Convert node async functions into most.js streams
View example.js
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 Jun 1, 2016
Fun with generators as infinite (synchronous) streams
View stream.js
function * empty() {}
function * cons (a, stream) {
yield a
yield * stream
}
function * concat (xs, ys) {
yield * xs
yield * ys
@briancavalier
briancavalier / babel-6-markdown-doctest-error.txt
Created May 11, 2016
Error from most.js `npm test` using babel 6 and markdown-doctest
View babel-6-markdown-doctest-error.txt
$ 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
You can’t perform that action at this time.