Skip to content

Instantly share code, notes, and snippets.

@gsavin
gsavin / graphql-expressapp.js
Last active July 12, 2017 22:53
Report GraphQL errors to Sentry using Raven
const { merge } = require('lodash')
function graphQLErrorFormatter (req) {
return error => {
if (logger.raven) {
const raven = logger.raven
if (error.path || error.name !== 'GraphQLError') {
raven.captureException(error,
merge({

Keybase proof

I hereby claim:

  • I am gsavin on github.
  • I am gsavin (https://keybase.io/gsavin) on keybase.
  • I have a public key ASApq26Bp15vH4ypKMJttoOVAai5Ium6ktqrB7Rtg9i9Sgo

To claim this, I am signing this object:

@gsavin
gsavin / recevoirNombre.cpp
Created November 9, 2015 09:49
Lire un nombre sur le port série Arduino
boolean recevoirNombre(long *value, long timeout) {
//
// Date du début de la fonction.
// On utilisera ça pour savoir depuis combien de temps on attend.
//
long startAt = millis();
int octetRecu=0; // variable pour octet recu
int compt=0; // variable locale comptage caractères reçus
boolean signe=true; // variable locale signe nombre recu
@gsavin
gsavin / Gu2Px.java
Created November 3, 2015 07:38
GraphStream : Compute node coordinates using a layout and convert them to pixels.
import org.graphstream.algorithm.generator.BarabasiAlbertGenerator;
import org.graphstream.graph.Node;
import org.graphstream.graph.implementations.DefaultGraph;
import org.graphstream.ui.layout.springbox.implementations.SpringBox;
import org.graphstream.ui.view.Viewer;
import org.graphstream.ui.view.ViewerPipe;
import org.graphstream.ui.geom.Point3;
public class Gu2Px {
@gsavin
gsavin / Convert2JSON.java
Last active August 29, 2015 14:21
GraphStream : JSON output
import java.io.InputStreamReader;
import java.io.IOException;
import java.io.PrintStream;
import java.lang.reflect.Array;
import java.util.Map;
import org.graphstream.graph.Graph;
import org.graphstream.graph.Node;
import org.graphstream.graph.Edge;
import java.lang.management.ManagementFactory;
import java.lang.management.MemoryMXBean;
import java.lang.management.MemoryUsage;
import java.util.Locale;
import org.graphstream.algorithm.generator.GridGenerator;
import org.graphstream.graph.Graph;
import org.graphstream.graph.implementations.DefaultGraph;
import java.awt.event.KeyEvent;
import java.awt.event.MouseEvent;
import javax.swing.JOptionPane;
import javax.swing.SwingUtilities;
import org.graphstream.algorithm.generator.BarabasiAlbertGenerator;
import org.graphstream.graph.Graph;
import org.graphstream.graph.implementations.AdjacencyListGraph;
import org.graphstream.ui.graphicGraph.GraphicElement;
@gsavin
gsavin / gist:4389549
Created December 27, 2012 16:23
Custom label attribute in GraphStream
import org.graphstream.graph.Graph;
import org.graphstream.graph.Node;
import org.graphstream.graph.implementations.DefaultGraph;
import org.graphstream.stream.thread.ThreadProxyPipe;
import org.graphstream.ui.swingViewer.Viewer;
public class CustomLabel extends ThreadProxyPipe {
Graph graph;
String labelKey;