Skip to content

Instantly share code, notes, and snippets.

Avatar

Jean-Baptiste Musso jbmusso

View GitHub Profile
View gist:8854735
v1 = g.addVertex([name: 'Alice']);
v2 = g.addVertex([name: 'Bob']);
g.addEdge(v1, v2, 'knows', [since: '1970']);
View gist:8854526
// Proposal: transactions over the Gremlin extension
var tx = new Transaction(); // g.begin();
var v1 = tx.g.addVertex('v1', {name: 'Alice'});
var v2 = tx.g.addVertex('v2', {name: 'Bob'});
tx.g.addEdge(v1, v2, 'knows', {since: '1970'});
// And/or, alternatively:
var tx = new Transaction();
tx.g.addVertex('v1', {name: 'Alice'});
tx.g.addVertex('v2', {name: 'Bob'});
View gist:10482052
npm http GET https://registry.npmjs.org/grex
npm http 304 https://registry.npmjs.org/grex
npm http GET https://registry.npmjs.org/inherits
npm http GET https://registry.npmjs.org/q
npm http GET https://registry.npmjs.org/request
npm http 304 https://registry.npmjs.org/inherits
npm http 304 https://registry.npmjs.org/request
npm http 304 https://registry.npmjs.org/q
npm http GET https://registry.npmjs.org/json-stringify-safe
npm http GET https://registry.npmjs.org/qs
View gist:4eb1dc69b2995210c355
client.execute('g.V().filter(function(it) { return it.get().value("lang") !== "java" });', callback)
Gremlin Server log:
[WARN] StandardOps - Exception processing a script on request [RequestMessage{, requestId=db546f8a-c671-a6ea-5bfe-7bc8786e4631, op='eval', processor='', args={gremlin=g.V().filter(function(it) { return it.get().value("lang") !== "java" });, accept=application/json, language=nashorn}}].
java.util.concurrent.CompletionException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.NoSuchMethodException: Can't unambiguously select between fixed arity signatures [(com.tinkerpop.gremlin.util.function.SPredicate), (com.tinkerpop.gremlin.util.function.SBiPredicate)] of the method com.tinkerpop.gremlin.tinkergraph.process.graph.TinkerGraphTraversal.filter for argument types [jdk.nashorn.internal.objects.ScriptFunctionImpl]
View gist:50c2d01757cdf49cdd0a
[WARN] StandardOps - Exception processing a script on request [RequestMessage{, requestId=2f27165c-f829-9aee-dac5-cf288466d531, op='eval', processor='', args={gremlin=g.v(id), bindings={id=1}, accept=application/json, language=gremlin-groovy}}].
java.util.concurrent.CompletionException: java.lang.RuntimeException: javax.script.ScriptException: javax.script.ScriptException: java.util.NoSuchElementException: The vertex with id id of type does not exist in the graph
at java.util.concurrent.CompletableFuture.internalComplete(CompletableFuture.java:205)
at java.util.concurrent.CompletableFuture$AsyncSupply.exec(CompletableFuture.java:482)
at java.util.concurrent.CompletableFuture$Async.run(CompletableFuture.java:428)
at io.netty.util.concurrent.DefaultEventExecutor.run(DefaultEventExecutor.java:36)
at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:116)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.RuntimeException: javax.script.ScriptException: javax.
View introrx.md

The introduction to Reactive Programming you've been missing

(by @andrestaltz)

So you're curious in learning this new thing called Reactive Programming, particularly its variant comprising of Rx, Bacon.js, RAC, and others.

Learning it is hard, even harder by the lack of good material. When I started, I tried looking for tutorials. I found only a handful of practical guides, but they just scratched the surface and never tackled the challenge of building the whole architecture around it. Library documentations often don't help when you're trying to understand some function. I mean, honestly, look at this:

Rx.Observable.prototype.flatMapLatest(selector, [thisArg])

Projects each element of an observable sequence into a new sequence of observable sequences by incorporating the element's index and then transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence.

@jbmusso
jbmusso / st2-replace-permille-char
Last active Nov 11, 2015
Sublime Text automatically replace permille char (‰) with percent char (%)
View st2-replace-permille-char
// edit config file: Sublime Text 2 > Preferences > Key Bindings - User
[{
"keys": ["‰"],
"command": "insert_snippet",
"args": {
"contents": "%"
}
}]
View primus.properties
gremlin.graph=com.thinkaurelius.titan.core.TitanFactory
storage.backend=cassandrathrift
storage.hostname=127.0.0.1
storage.cassandra.keyspace=primus # Defaults to titan
index.primus.backend=elasticsearch
index.primus.hostname=127.0.0.1
View secundus.properties
gremlin.graph=com.thinkaurelius.titan.core.TitanFactory
storage.backend=cassandrathrift
storage.hostname=127.0.0.1
storage.cassandra.keyspace=secundus
index.secundus.backend=elasticsearch
index.secundus.hostname=127.0.0.1
View Gremlin Server bindings.md

Raw message sent:

{
  "requestId": "56da9f40-d32f-11e5-bea1-0164965f4534",
  "processor": "",
  "op": "eval",
  "args": {
    "gremlin": "foo",
    "bindings": {
      "foo": {