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
class LazyList { | |
def car | |
private Closure cdr | |
def LazyList next() { cdr() } | |
def List take(n) { | |
def r = []; def l = this | |
(1..n).each{ r << l.car; l++ } | |
return r | |
} | |
def LazyList filter(Closure pred) { |
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
// ==UserScript== | |
// @match http://famo.us/* | |
// ==/UserScript== | |
function addJQuery(callback) { | |
var script = document.createElement("script"); | |
script.setAttribute("src", "//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"); | |
script.addEventListener('load', function() { | |
var script = document.createElement("script"); | |
script.textContent = "window.jQ=jQuery.noConflict(true);(" + callback.toString() + ")();"; |
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 org.glassfish.jersey.internal.util.collection.Ref; | |
import org.junit.Test; | |
import javax.servlet.http.HttpServletRequest; | |
import java.lang.reflect.ParameterizedType; | |
import java.lang.reflect.Type; | |
import static org.hamcrest.CoreMatchers.*; | |
import static org.junit.Assert.*; |
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.example; | |
import static org.hamcrest.CoreMatchers.is; | |
import static org.hamcrest.MatcherAssert.assertThat; | |
import java.util.Arrays; | |
import java.util.Collections; | |
import java.util.LinkedHashSet; | |
import java.util.Set; |
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
KStreamBuilder builder = new KStreamBuilder(); | |
KStream<String, String> source = builder.stream("streams-file-input"); | |
KTable<String, Long> counts = source | |
.flatMapValues(value -> Arrays.asList(value.toLowerCase(Locale.getDefault()).split(" "))) | |
.map((key, value) -> new KeyValue<>(value, value)) | |
.countByKey("Counts"); | |
counts.to(Serdes.String(), Serdes.Long(), "streams-wordcount-output"); | |
KafkaStreams streams = new KafkaStreams(builder, props()); |
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.example.demo; | |
import static org.junit.Assert.assertTrue; | |
import java.util.HashMap; | |
import java.util.Map; | |
import java.util.concurrent.CountDownLatch; | |
import java.util.concurrent.TimeUnit; | |
import org.apache.kafka.clients.consumer.ConsumerConfig; |
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.example.demo; | |
import java.util.Arrays; | |
import java.util.Properties; | |
import java.util.concurrent.ExecutionException; | |
import java.util.stream.IntStream; | |
import org.apache.kafka.clients.consumer.ConsumerConfig; | |
import org.apache.kafka.clients.consumer.ConsumerRecords; | |
import org.apache.kafka.clients.consumer.KafkaConsumer; |
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.example.demo; | |
import static org.junit.Assert.assertTrue; | |
import java.util.HashMap; | |
import java.util.Map; | |
import java.util.concurrent.CountDownLatch; | |
import java.util.concurrent.TimeUnit; | |
import org.apache.kafka.clients.consumer.ConsumerConfig; |
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.example.demo; | |
import java.util.concurrent.CountDownLatch; | |
import java.util.concurrent.TimeUnit; | |
import org.apache.kafka.clients.consumer.ConsumerRecord; | |
import org.slf4j.Logger; | |
import org.slf4j.LoggerFactory; | |
import org.springframework.beans.factory.annotation.Autowired; | |
import org.springframework.boot.CommandLineRunner; |
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.example.demo; | |
import org.junit.Test; | |
import java.time.LocalDate; | |
import java.time.chrono.JapaneseDate; | |
import java.time.format.DateTimeFormatter; | |
import java.time.format.DateTimeParseException; | |
import java.time.format.ResolverStyle; | |
import java.util.Locale; |