This file contains 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
// going to use _ for array flattening until this - http://yuilibrary.com/projects/yui3/ticket/2531371 is resolved. | |
var _ = require('underscore'), | |
YUI = require('yui3').YUI; | |
YUI.add('node-js', function (Y) { | |
Y.namespace('nodejs'); | |
Y.nodejs.require = function () { | |
var requires = {}, | |
modules = _.flatten(arguments); |
This file contains 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
match = require 'minimatch' | |
_ = require 'underscore' | |
class Events | |
constructor: -> | |
@_events = []; | |
on: (evt, handler = _.i, scope = @) -> | |
@_events.push {evt, handler, scope};@ | |
fire: (evt, args...) -> | |
_.each @_events, (spec) => |
This file contains 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
match = require 'minimatch' | |
_ = require 'underscore' | |
class Events | |
on: (evt, handler = _.i, scope = @) -> | |
@_events or= [] | |
spec = | |
evt: evt | |
handler: handler | |
scope: scope |
This file contains 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 q = function() { | |
var args = _.flatten(arguments); | |
var ctr = args.length; | |
var complete; | |
function run(i) { | |
args[i](function() { | |
if (i + 1 === ctr) { | |
if (complete) { | |
complete(); |
This file contains 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!'); |
This file contains 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 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 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 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 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), |
OlderNewer