Skip to content

Instantly share code, notes, and snippets.

View mgandin's full-sized avatar

Mathieu Gandin mgandin

View GitHub Profile
@mgandin
mgandin / Vagrantfile
Last active August 29, 2015 14:02
Hello Vagrant world
# -*- mode: ruby -*-
# vi: set ft=ruby :
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.define :ubuntu do |ubuntu|
ubuntu.vm.box = "ubuntu"
ubuntu.vm.network "private_network", ip: "10.11.12.13"
@mgandin
mgandin / ConcurrentFooBar.java
Last active August 29, 2015 14:01
Some small examples in Java 8 with new java.time API, Stream, Lambdas, CompletableFuture, String Joiner, ParallelPrefix & ParallelSetAll in Arrays, File & Path Closeable Stream, List.sort and Map.compute & merge
package fr.mga.spike;
import java.util.concurrent.*;
public class ConcurrentFooBar {
public static String fooBar(int anInteger) {
String result = "";
if (anInteger % 3 == 0)
result += "foo";
@mgandin
mgandin / HelloControllerSpec.js
Last active August 29, 2015 13:57
Hello Angular World
'use strict';
describe("HelloController", function() {
var isTrue;
var helloController;
var scope;
beforeEach(angular.mock.module('helloWorld.app'));
beforeEach(angular.mock.inject(function($rootScope, $controller){
@mgandin
mgandin / ConcurrentFooBarQix.java
Last active February 23, 2022 01:03
A small example to monitor Java Thread Pool with JMX
package fr.mga.concurrent;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.*;
public class ConcurrentFooBarQix implements Callable<String> {
@mgandin
mgandin / ConcurrentFooBarQix.java
Last active December 25, 2015 17:19
Concurrent FooBarQix
package fr.mga.foobarqix;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.*;
public class ConcurrentFooBarQix implements Callable<String> {
private int toFooBar;
@mgandin
mgandin / EmbeddedMongoDb.java
Last active June 7, 2019 15:54
How to embed MongoDb for your Junit Integration test
import java.io.IOException;
import de.flapdoodle.embed.mongo.MongodExecutable;
import de.flapdoodle.embed.mongo.MongodProcess;
import de.flapdoodle.embed.mongo.MongodStarter;
import de.flapdoodle.embed.mongo.config.MongodConfigBuilder;
import de.flapdoodle.embed.mongo.config.Net;
import de.flapdoodle.embed.mongo.distribution.Version;
import de.flapdoodle.embed.process.runtime.Network;