Skip to content

Instantly share code, notes, and snippets.

@moreau-nicolas
moreau-nicolas / GenerateDisplayNameFromSourceElements.java
Created March 15, 2023 11:07
An annotation to customize test name generation in JUnit5.
package test;
import org.junit.jupiter.api.DisplayNameGeneration;
import org.junit.jupiter.api.DisplayNameGenerator;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import java.lang.reflect.Method;
@moreau-nicolas
moreau-nicolas / FizzBuzz.hs
Created March 8, 2018 13:13
Haskell FizzBuzz
module FizzBuzz (main, fizzBuzz) where
import Data.Foldable
import Data.Maybe
isMultipleOf :: Int -> Int -> Bool
n `isMultipleOf` f = n `mod` f == 0
fizzBuzz :: Int -> String
fizzBuzz x = fromMaybe (show x) (fold rules x)
@moreau-nicolas
moreau-nicolas / .gitconfig
Last active October 21, 2019 20:11
My Git configuration file
[alias]
git = ! git
st = status
ci = commit
co = checkout
glog = log --graph --oneline --decorate --branches --tags --date-order --full-history
lg = log --graph --decorate --date-order --full-history --pretty=format:'%C(yellow)%h%Creset <%C(red)%an%Creset> (%C(green)%ai%Creset)%C(auto)%d%Creset %s'
lga = log --graph --decorate --date-order --full-history --pretty=format:'%C(yellow)%h%Creset <%C(red)%an%Creset> (%C(green)%ai%Creset)%C(auto)%d%Creset %s' --all
@moreau-nicolas
moreau-nicolas / Retry.java
Created May 2, 2016 14:26
A generic retry mechanism in Java 8
package com.github.moreaunicolas;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.time.Duration;
import java.util.Optional;
import java.util.function.Predicate;
import java.util.function.Supplier;