Lets suppose that instead of wanting to trigger a linear set of functions such as the core Node.js EventEmitter, you wanted to be able to trigger events as a (potentially cyclic) directed graph.
Scenario 1. A causes B & C to fire
A
├─B
│
└────C
var uuid = require('uuid'), | |
accounting = require('accounting'), | |
benchmark = require('benchmark'); | |
(new benchmark.Suite()) | |
.add('process.hrtime', function () { | |
var foo = process.hrtime().join(''); | |
foo += '-0'; | |
}) | |
.add('uuid', function () { |
$ git pull Jinkwon master | |
remote: Counting objects: 5, done. | |
remote: Compressing objects: 100% (4/4), done. | |
remote: Total 5 (delta 0), reused 0 (delta 0) | |
Unpacking objects: 100% (5/5), done. | |
From https://github.com/Jinkwon/http-server | |
* branch master -> FETCH_HEAD | |
Updating 4407db1..c5839f8 | |
Fast-forward | |
.gitignore | 2 ++ |
function showRating (target) { | |
$('#ratingHistorySection .retable li').each(function (el) { | |
var child = $(this).find('.rating .starbar'); | |
var rating = $(child).attr('data-your-rating'); | |
if (rating != target) { | |
$(this).hide(); | |
} | |
}); | |
} |
Lets suppose that instead of wanting to trigger a linear set of functions such as the core Node.js EventEmitter, you wanted to be able to trigger events as a (potentially cyclic) directed graph.
Scenario 1. A causes B & C to fire
A
├─B
│
└────C
var assert = require('assert'); | |
var targs = module.exports = function (args, names) { | |
var types = Object.keys(names); | |
return args.reduce(function (ret, arg) { | |
var type = typeof arg; | |
if (~types.indexOf(type)) { | |
ret[names[type]] = arg; | |
} |
<!DOCTYPE html> | |
<html xmlns="http://www.w3.org/1999/xhtml"> | |
<head> | |
<meta charset="utf-8"> | |
<title>The Largest Vocabulary in Hip hop</title> | |
<script src="http://d3js.org/d3.v3.min.js"></script> | |
<meta http-equiv="content-type" content="text/html;charset=utf-8" /> |
{ | |
"Afghanistan": "Asia", | |
"Aland Islands": "Europe", | |
"Albania": "Europe", | |
"Algeria": "Africa", | |
"Andorra": "Europe", | |
"Angola": "Africa", | |
"Anguilla": "North America", | |
"Antigua and Barbuda": "North America", | |
"Argentina": "South America", |
<!DOCTYPE html> | |
<meta charset="utf-8"> | |
<style> | |
body { | |
font: 10px sans-serif; | |
} | |
.chord { | |
fill-opacity: .67; |