This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
protected void configure() { | |
// ... insert the bindings here | |
binder().disableCircularProxies(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import static org.mockito.Mockito.*; | |
import java.util.concurrent.*; | |
import org.junit.*; | |
import org.mockito.*; | |
import org.mockito.stubbing.*; | |
public class TestMockito { | |
@Test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public interface Function<T, R> { | |
R apply(T t); | |
static Function<?, String> toStringFunction() { | |
return value -> value.toString(); | |
} | |
static <E> Function<E, E> identity() { | |
return value -> value; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public Process startProxy() | |
{ | |
try | |
{ | |
String proxyPath = Path.Combine(Paths.ResourcesPath,"whale.exe"); | |
return Process.Start(proxyPath); | |
} catch(System.ComponentModel.Win32Exception we) | |
{ | |
Logger.LogError(we.Message); | |
return null; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package net.gageot; | |
import java.util.*; | |
import java.util.concurrent.*; | |
public class TestThreads { | |
public static final int NB = 100000; | |
public static void main(String[] args) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package net.gageot.listmaker; | |
import static java.util.Objects.*; | |
import java.util.*; | |
import java.util.function.*; | |
import java.util.stream.*; | |
import javax.annotation.*; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
echo 'Convert .doc to .html' | |
# Convert | |
for file in *.doc ;do | |
asciidoc $file | |
done | |
# Add auto-reload js | |
for file in *.html ;do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.stream.*; | |
public class FooFooLambdaWtf { | |
public static void main(String[] args) { | |
// prints FooBar | |
String fooBar = IntStream.range(1, 10).mapToObj(FooFooLambdaWtf::foorBar).collect(Collectors.joining()); | |
System.out.println(fooBar); | |
// prints FooFooFooFooFooFooFooFooFoo | |
String fooFooFoo = IntStream.range(1, 10).mapToObj(i -> (i == 3) ? "Foo" : (i == 5) ? "Bar" : "").collect(Collectors.joining()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def next_syracuse(n) | |
return n/2 if n.even? | |
3*n+1 | |
end | |
def syracuse(n) | |
etapes = [n] | |
while etapes.last != 1 | |
etapes << next_syracuse(etapes.last) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main; | |
import com.google.common.base.Strings; | |
import com.google.common.io.ByteStreams; | |
import com.sun.jersey.spi.container.ContainerRequest; | |
import com.sun.jersey.spi.container.ContainerResponse; | |
import com.sun.jersey.spi.container.ContainerResponseFilter; | |
import javax.ws.rs.core.MediaType; | |
import javax.ws.rs.core.Response; |