Skip to content

Instantly share code, notes, and snippets.

View pier-oliviert's full-sized avatar

Pier-Olivier Thibault pier-oliviert

View GitHub Profile
let index = -1
do {
index += 1
const nodes = walker.currentNodes
for (const node of nodes) {
row.addNode(node)
}
walker.nextStep()
this.nodes = this.walkers.map(walker => {
walker.advance()
let node = walker.currentNode
const positions = this.walkers.map(walker => walker.positionFor(node))
if (!node || Math.max.apply(this, positions) > this.index) {
node = walker.passthrough()
}
return node
})
class Branch {
constructor(nodes) {
this.branches = []
this.nodes = []
_.compact(_.flatten([nodes])).map(node => {
this.insertNode(node)
})
this.dataset = {}
}
class Linker {
constructor(nodes, edges) {
this.cache = new Cache(nodes, edges)
}
process(edges) {
const nodes = this.link(this.findRootEdges(edges))
Object.defineProperty(this, "nodes", {
value: Object.freeze(nodes)
})
class Linker {
constructor(nodes) {
this.cache = this.create(nodes)
}
process(edges) {
const nodes = this.link(this.findRootEdges(edges))
Object.freeze(nodes)
Object.defineProperty(this, "nodes", {
value: nodes
document.querySelector(`workflow-node[data-sources~='${this.dataset.oid}']`)
{
"nodes": [
{"id": "1", "name": "A node"},
{"id": "2", "name": "Another node"},
],
"edges": [
{"source": "1", "target": "2"}
]
}
{
startsWith() {
return (
<div id="hello">
</div>
);
}
test() {
document.getElementById("hello")
<%= url('/:post.year/:post.month/:post.slug', post: post) %>
class Post
def year
self.published_at.month
end
def month
self.published_at.month
end
def to_params