Skip to content

Instantly share code, notes, and snippets.

Florent Biville fbiville

Block or report user

Report or block fbiville

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@fbiville
fbiville / ResultExtensionTest.kt
Last active Mar 1, 2019
kotlin.Result - flatMap extension
View ResultExtensionTest.kt
import net.jqwik.api.ForAll
import net.jqwik.api.Property
// requires compiler option '-Xallow-result-return-type'
fun <T, U> Result<T>.flatMap(function: (T) -> Result<U>): Result<U> {
return if (isSuccess) {
function(getOrNull()!!)
} else {
Result.failure(this.exceptionOrNull()!!)
}
@fbiville
fbiville / gist:3041a07f8e83f3925815c74a68184143
Created Nov 27, 2018
Hands on Neo4j - Devoxx Morocco 2018 - solutions
View gist:3041a07f8e83f3925815c74a68184143
[
{
"instructions": "Find the number of movies",
"solution": "MATCH (m: Movie) RETURN COUNT(m);"
},
{
"instructions": "Find the number of action movies",
"solution": "MATCH (m: Movie {genre: 'Action'}) RETURN COUNT(m);"
},
{
@fbiville
fbiville / prepend_test.go
Last active Oct 5, 2018
Golang property-based testing example
View prepend_test.go
package main
import (
"testing"
"testing/quick"
)
func TestSlicePrepend(t *testing.T) {
f := func(head string, tail []string) bool {
result := prepend(head, tail)
@fbiville
fbiville / configuration-zsh.sh
Created Sep 4, 2018
Zsh custom config in workstation-setup
View configuration-zsh.sh
echo
echo "Configuring zsh"
brew install grc
brew install coreutils
brew install watch
brew install z
touch ~/.z
brew install zsh zsh-completions
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
cp files/dircolors.ansi-dark ~/.dircolors
@fbiville
fbiville / CustomContextInitializer.java
Last active Aug 30, 2018
Dynamic WireMock port in Spring Boot test
View CustomContextInitializer.java
import org.assertj.core.util.Maps;
import org.springframework.context.ApplicationContextInitializer;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.MapPropertySource;
import java.util.Map;
import static org.springframework.util.SocketUtils.findAvailableTcpPort;
public class CustomContextInitializer implements ApplicationContextInitializer<ConfigurableApplicationContext> {
View stack.trace
2018-01-02 13:29:13
Full thread dump Java HotSpot(TM) 64-Bit Server VM (25.151-b12 mixed mode):
"Attach Listener" #151 daemon prio=9 os_prio=0 tid=0x00007f6b89288800 nid=0x219a waiting on condition [0x0000000000000000]
java.lang.Thread.State: RUNNABLE
"BuilderThread 3" #76 prio=5 os_prio=0 tid=0x00007f6b89285800 nid=0x1bac waiting on condition [0x00007f6b6eb34000]
java.lang.Thread.State: WAITING (parking)
at sun.misc.Unsafe.park(Native Method)
- parking to wait for <0x00000000807ff168> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)
@fbiville
fbiville / EmbeddedGraphDatabaseRule.java
Created Aug 27, 2017
Neo4J embedded database JUnit rule that works consistenly against all Neo4j 3.x stable versions
View EmbeddedGraphDatabaseRule.java
import org.junit.rules.TestRule;
import org.junit.runner.Description;
import org.junit.runners.model.Statement;
import org.neo4j.graphdb.GraphDatabaseService;
import org.neo4j.graphdb.Transaction;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.function.BiFunction;
@fbiville
fbiville / DESCRIPTION.md
Last active Nov 26, 2016
Dr Who dataset for Neo4j 3.x
View DESCRIPTION.md

Initial Doctor Who dataset

This is based on the data published by Neo Technology.

The main difference lies in the introduction of labels and the export in Cypher rather than the raw Neo4j files. This offers a greater interoperability (the raw files do not work on Neo4j 3.x instances).

The dataset is in dr-who.cypher.

Import with neo4j-shell

@fbiville
fbiville / 1_pom.xml
Last active Oct 23, 2016
Liquigraph 2.0.0 with Neo4j 3.x in embedded and file mode (spoiler alert: it won't work)
View 1_pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>net.biville.florent</groupId>
<artifactId>test-liquigraph-neo4j3-liquigraph2</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>test-liquigraph-neo4j3-liquigraph2</name>
@fbiville
fbiville / Record.java
Last active Sep 18, 2016
Neo4j (3.0.4) stored procedure records cannot contain record types
View Record.java
public class Record {
public Record record;
}
You can’t perform that action at this time.