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 java.nio.charset.StandardCharsets.*; | |
import static javax.script.ScriptContext.*; | |
import java.io.*; | |
import net.codestory.http.io.*; | |
import javax.script.*; | |
public class CoffeeToJs { |
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
public class Types { | |
interface SMI<T> { | |
T get(T value); | |
} | |
public static void main(String[] args) { | |
SMI<String> inner = new SMI<String>() { | |
@Override | |
public String get(String param) { |
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
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
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; |
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 com.fractales.synchro.helpers.phantomjs; | |
import com.google.common.io.ByteStreams; | |
import com.google.common.io.Files; | |
import com.google.common.io.InputSupplier; | |
import com.google.common.io.OutputSupplier; | |
import com.google.common.io.Resources; | |
import java.io.File; | |
import java.io.FileOutputStream; |