Skip to content

Instantly share code, notes, and snippets.

View Raynos's full-sized avatar

Jake Verbaten Raynos

View GitHub Profile
// A pull stream is a function readable(closing, cb<err, chunk>)
// To extract a chunk out of the stream simply call (null, cb)
// to get another value call it again.
// The stream will tell you if it's ended by invoking cb(true)
// The stream will tell you if it errored by invoking cb(Error)
// You can tell the stream to close / destroy by calling stream(true, cb)
var stream = (function () {
var list = [1, 2, 3, 4]
return function stream(closing, callback) {
@Raynos
Raynos / Readme.md
Created April 4, 2013 21:09 — forked from Gozala/Readme.md

Signal

Signal represents collection of values (over time) associated with a single identity. It can be expressed as follows:

function signal(next) {
  next(1)
  next(2)
 next(3)
// Load the TCP Library
net = require('net');
// Keep track of the chat clients
var clients = [];
// Start a TCP Server
net.createServer(function (socket) {
// Identify this client
var task = require("monk")
var shell = require("monk-shell")
var buildTask = task("build", function (rule) {
rule("hello.c", "hello.o",
shell("gcc -Wall -c %i -o %o"))
rule("square.c", "square.o",
shell("gcc -Wall -c %i -o %o"))
@Raynos
Raynos / x.js
Last active January 2, 2016 01:29
// don't pass monk in as an argument, just require it
var monk = require("monk")
var rule = require("monk/rule")
var less = require("monk-less");
var compress = require("monk-compress")
// don't exports.x = bar
// just create functions.
function build() {
// don't have magic glob or mapFile. Just have sensible defaults

why ./task.js?

One word: task automation. It's basically zero effort and you can use the ./task.js package manager to handle any repetitive tasks. You can use ./task.js to automate everything with minimum effort.

./task.js provides the structure, order, and authority that you as a developer so desperately crave. ./task.js will also take responsibility for your actions if you need it to. It's what everybody is using now. ./task.js is the new hotness. It's all about ./task.js now, just like that.

This is compared to npm run/bash scripts, which are:

@Raynos
Raynos / app.js
Last active August 29, 2015 13:57 — forked from jlongster/app.js
var hash = require('observ-hash')
var array = require('observ-array')
var observ = require('observ')
var dom = React.DOM;
var App = React.createClass({
getInitialState: function() {
// create observable immutable data structure
var state = hash({
@Raynos
Raynos / thunk.js
Last active August 29, 2015 13:57 — forked from Matt-Esch/thunk.js
var cuid = require("cuid")
var dom = require("./render")
var diff = require("./diff")
var patch = require("./patch")
var isString = require("./lib/is-string")
/* Usage
var thunk = require("virtual-dom/thunk")
@Raynos
Raynos / index.js
Last active August 29, 2015 14:02 — forked from neonstalwart/index.js
var mercury = require("mercury")
var h = mercury.h
var state = mercury.hash({})
function render(state) {
return h("ul", [
h('li', h('a', { href: '#foo' }, 'link without array')),
h('li', [ h('a', { href: '#bar' }, 'link with array') ])
])
var people = varhash({}, function setPerson (obj, key), {
return struct({
id: key,
name: value(obj.name)
})
})
var teams = varhash({}, function setTeam (obj, key) {
return struct({
id: key,