Skip to content

Instantly share code, notes, and snippets.

View Fabszn's full-sized avatar
🏠
Home coder

Fabrice Sznajderman Fabszn

🏠
Home coder
View GitHub Profile
public class LambdaJBenchmark implements Benchmark {
public void iterateSimpleList(final List<String> lines) {
convert(lines, new Converter<Object, Object>() {
public Object convert(Object o) {
return o;
}
});
}
public class BenchmarkProxyManager implements InvocationHandler {
private Benchmark o;
public BenchmarkProxyManager(Benchmark o) {
this.o = o;
}
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
final Benchmark java = BenchmarkProxyManager.getProxiedClass(JavaBenchmark.class);
final Benchmark guava = BenchmarkProxyManager.getProxiedClass(GuavaBenchmark.class);
final Benchmark lambdaj = BenchmarkProxyManager.getProxiedClass(LambdaJBenchmark.class);
java.iterateSimpleList(lines);
@Fabszn
Fabszn / index.html
Created November 5, 2012 20:08
Sample of use of Jquery.position()
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="http://code.jquery.com/ui/1.9.0/themes/base/jquery-ui.css">
<script type="text/javascript" src="http://code.jquery.com/jquery-1.8.2.js"></script>
<script type="text/javascript" src="http://code.jquery.com/ui/1.9.0/jquery-ui.js"></script>
package javapuzzle;
import com.google.common.base.Joiner;
import com.google.common.base.Predicate;
import com.google.common.collect.Collections2;
import com.google.common.collect.Lists;
import java.util.Collection;
import java.util.List;
package codeStory2013;
import java.util.*;
/**
* .
*
* @author fsznajderman
* date : 03/02/13
*/
@Fabszn
Fabszn / PaserXML_Scala
Last active December 21, 2015 04:58
L'idée du bout de code est de parser un ensemble de fichier XML. Pour chaque fichier on récupère l'ensemble des balises 'value'. Pour chaque balise value on regarde si l'attribut 'name' est égale à un chaine, dans l'exemple : returnType. Si on trouve une égalité alors on affiche le nom du fichier avec le contenu de la balise sinon on ne fait rien.
object Parser {
def main(args: Array[String]) {
new File(/*[DIRECTORY_PATH"*/).listFiles() foreach (f => {
val xml = XML.loadFile(f.getPath)
(xml \\ "value") foreach (v =>
(v \ "@name").text match {
case "returnType" => println( f.getName.split('.')(0) + " , " + v.text)
case _ =>
}
)
@Fabszn
Fabszn / main.scala
Created April 18, 2014 17:19
Analyse of file from data.gouv.fr
import scala.io.Source
import scala.util.parsing.json.{JSONObject, JSONFormat, JSONArray}
/**
* Created by fsznajderman on 16/04/2014.
*/
object main {
case class Accident(lum: Int, agg: Int, int: Int, atm: Int, col: Int, catr: Int, grav: Float)
package utils
import rapture.io._
import org.jsoup.Jsoup
import akka.actor.Actor
import scala.language.implicitConversions
import java.net.MalformedURLException
/**
* User: fsznajderman
@Fabszn
Fabszn / OtherCase.java
Created November 28, 2014 17:04
Un exemple à partir de l'Optional de Guava
import com.google.common.base.Optional;
import model.Contact;
/**
* Created by fsznajderman on 28/11/2014.
*/
public class OtherCase {