Skip to content

Instantly share code, notes, and snippets.

@lfo
lfo / Dart code sample
Last active August 29, 2015 13:55
Gist comprenant le code dart des slides
import 'dart:convert' show JSON;
import 'dart:io';
import 'dart:async';
/////////////////////////////////////////////////////////////
// Définition d’une fonction.
printNumber(num aNumber) {
print('The number is $aNumber.'); // Écrit dans la console.
}
@lfo
lfo / SongRecommendation
Last active August 29, 2015 14:02
Song recommendation
== Song Recommendation
According to this simple following graph :
image::https://gist.github.com/lfo/f896ce05e3046adfe4e3/raw/f676b878e0cbe6389b2a5b4b7f987d781a7de77b/model.png[]
I would like to get recommendation for songs and artists. Indeed, Artist has recorded songs that some persons love.
If somebody love the same song than mine, I will more probably love its other loved songs.
@lfo
lfo / ClassUtil
Created July 5, 2013 19:25
Some usefull reflection method
import java.lang.reflect.ParameterizedType;
public class ClassUtil {
public static Class getParameterClass(Class parametizedClass, int index) {
return (Class) ((ParameterizedType) parametizedClass.getGenericInterfaces()[0]).getActualTypeArguments()[index];
}
}
@lfo
lfo / launchMaven
Created July 19, 2013 09:35
Debug maven test externally in windows share mode
mvn clean install -Dmaven.surefire.debug=-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_shmem,server=y,address=Maven,suspend=n
# In Netbeans Debug/attachDebugger with
# connector : SharedMemory
# Name : Maven
# Timeout : 10 000
@lfo
lfo / LearnCypherWithTheCure
Last active January 4, 2016 17:09
Learn Cypher with The Cure
= Learn cypher with The Cure.
All informations are from wikipedia : http://en.wikipedia.org/wiki/The_Cure
//hide
//setup
[source,cypher]
----
CREATE (theCure:Artist { name:'The Cure' })
// Avoid NPE simply taken from : http://winterbe.com/posts/2015/03/15/avoid-null-checks-in-java/
public static <T> Optional<T> resolve(Supplier<T> resolver) {
try {
T result = resolver.get();
return Optional.ofNullable(result);
}
catch (NullPointerException e) {
return Optional.empty();
}
choco install ChocolateyGUI -y
choco install ConEmu -y
choco install ditto -y
choco install f.lux -y
choco install fiddler4 -y
choco install Graphviz -y
choco install greenshot -y
choco install javaruntime -y
choco install jre8 -y
choco install keepass -y
@lfo
lfo / HOWTO.md
Last active January 19, 2018 11:42
@lfo
lfo / .gitconfig
Last active October 3, 2019 12:26
[user]
name = lfo
email = laurent.foret@gmail.com
[alias]
lg = !"git lg1"
lg1 = !"git lg1-specific --all"
lg1-specific = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)'
co = checkout
br = branch
ci = commit