Skip to content

Instantly share code, notes, and snippets.


Jean-Baptiste Musso jbmusso

View GitHub Profile

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.

View react-clearfix.js
'use strict';
import React from 'react';
export default class Clearfix extends React.Component {
render() {
const beforeStyle = {
display: 'table'
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(
at java.util.concurrent.CompletableFuture$AsyncSupply.exec(
at java.util.concurrent.CompletableFuture$
at io.netty.util.concurrent.SingleThreadEventExecutor$
Caused by: java.lang.RuntimeException: javax.script.ScriptException: javax.
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]
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 gist:10482052
npm http GET
npm http 304
npm http GET
npm http GET
npm http GET
npm http 304
npm http 304
npm http 304
npm http GET
npm http GET
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'});