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
// store.js | |
let {store, handler} = sto(initialState, reduceFn); // where reduceFn: function(currentState, action, ...args){} | |
dispatcher.register(handler); | |
export store; | |
// elsewhere | |
store.get() // -> current state | |
store.toObservable() // -> to be used with .observe() |
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
"use strict"; | |
var [BRA, KET, IDENT] = ['BRA', 'KET', 'IDENT']; | |
function last(arr){ return arr[arr.length -1] }; | |
export default function act(src, prefix){ | |
var tree = src.split('').reduce((tokens, char)=> { | |
if(char==='{'){ | |
tokens.push({type: BRA}); |
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 csp = require('js-csp'), | |
{ chan, putAsync, take, go, put, timeout, spawn} = csp, | |
request = require('superagent'); | |
var urls = ['http://www.google.com', 'http://www.jlongster.com', 'http://www.myntra.com']; | |
go(function*(){ | |
// 1. do a bunch of requests in parallel, and save their response lengths | |
var parallel = yield map(urls, function*(url){ | |
return (yield fetch(url)).text.length; |
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
diff --git a/src/clj/cljs/repl/node_repl.js b/src/clj/cljs/repl/node_repl.js | |
index 6bc1cd2..46e7f7e 100644 | |
--- a/src/clj/cljs/repl/node_repl.js | |
+++ b/src/clj/cljs/repl/node_repl.js | |
@@ -1,6 +1,7 @@ | |
process.env.NODE_DISABLE_COLORS = true; | |
-var net = require("net"); | |
+var net = require("net"), | |
+ vm = require('vm'); |
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 _ = require('underscore'), | |
Parser = require('jade/lib/parser'); | |
module.exports = { | |
toJSON: toJSON, | |
fromJSON: fromJSON | |
} | |
function toJSON(src, options) { | |
var parser = new Parser(src), |
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
oia(lets [go chan put take timeout alts] (require 'js-csp/lib/csp') (do | |
(fn fake [kind] | |
(fn [c query] | |
(go (gen [] | |
(yield (take (timeout (js Math.random()*200)))) | |
(yield (put c [kind query])))))) | |
(def web1 (fake :web1)) | |
(def web2 (fake :web2)) |
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 util = require('util'), | |
_ = require('underscore'), | |
EventEmitter = require('events').EventEmitter | |
function Store(ctx, initial) { | |
this.state = initial || {}; | |
EventEmitter.call(this); | |
this.initialize.apply(this, arguments); | |
} |
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 _ = require('underscore'); | |
var domready = require('domready'), | |
bean = require('bean'), // events | |
bonzo = require('bonzo'), // DOM wrapper/manipulation | |
qwery = require('qwery'), // css selectors | |
morpheus = require('morpheus'), | |
slice = Array.prototype.slice; | |
// Attach events API to the prototype of DOM wrapper: |
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
"use strict"; | |
var _ = require('underscore'), | |
slice = [].slice; | |
var mutations = { | |
append: append, | |
remove: remove, | |
replace: replace, | |
setAttr: setAttr |
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
k.task('a', function(done){ done(); }); | |
k.task('b', function(done){ done(); }); | |
k.task('c', function(done){ | |
this.D.a().b().then(done); | |
}); | |
k().D.c().then(function(){ | |
console.log('done!'); |