Skip to content

Instantly share code, notes, and snippets.

@lfo
lfo / Dart code sample
Last active Aug 29, 2015
Gist comprenant le code dart des slides
View Dart code sample
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 Aug 29, 2015
Song recommendation
View SongRecommendation
== 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 Jul 5, 2013
Some usefull reflection method
View ClassUtil
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 Jul 19, 2013
Debug maven test externally in windows share mode
View launchMaven
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 Jan 4, 2016
Learn Cypher with The Cure
View LearnCypherWithTheCure
= 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' })
View Java8Tips
// 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();
}
View chocolatey.packages
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
View HOWTO.md
View .gitconfig
[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