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
function layout() { | |
try { | |
var adjacencyList = eval('adjacencyList = ' + $('#adjacency-list').val()); | |
} catch (e) { alert(e); } | |
var cells = buildGraphFromAdjacencyList(adjacencyList); | |
graph.resetCells(cells); | |
joint.layout.DirectedGraph.layout(graph, { setLinkVertices: false }); |
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
function layout(graph) { | |
var graphJSON = { id: 'root', children: [], edges: [] }; | |
_.each(graph.getElements(), function(el) { | |
graphJSON.children.push({ | |
id: el.id, | |
width: el.get('size').width, | |
height: el.get('size').height | |
}); | |
}); |
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 m = require('statechart-sync'); | |
m.count = 3; | |
m.done = function() { /* ... */ }; | |
var dispatch = function(err, doc) { m.dispatch(err ? 'error' : 'data', err || doc); | |
m.run(); | |
db.get('myID1', dispatch); | |
db.get('myID2', dispatch); |
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 machine = _.extend({ | |
// slots | |
count: 1, | |
done: function() {}, | |
// logic | |
initialState: 'Init', | |
states: { |
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 deferredValue = promiseMe(); | |
deferredValue.then(function done(data) { /*...*/ }); |
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
function getData(callback) { | |
callAsync(function(data) { | |
callback(data); | |
}) | |
} | |
getData(function done() { /* ... */ }); |
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 paper = Raphel('paper', 400, 300), | |
rect = paper.rect(50, 50, 100, 30), | |
circle = paper.circle(200, 100, 20); | |
rect.joint(circle); |