This file contains hidden or 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
(require '[clojure.test :refer :all ]) | |
;flush | |
(defn flush? | |
[hand] | |
(= 1 (count | |
(distinct | |
(map first hand))))) | |
;straight |
This file contains hidden or 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 boxpacking; | |
import java.io.BufferedReader; | |
import java.io.IOException; | |
import java.io.InputStreamReader; | |
import java.net.URL; | |
import java.util.ArrayList; | |
import java.util.HashMap; | |
import java.util.Map; |
This file contains hidden or 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.benstopford.coherence.bootstrap.structures.framework; | |
import java.text.DecimalFormat; | |
import java.util.ArrayList; | |
import java.util.List; | |
import java.util.concurrent.TimeUnit; | |
import static java.util.concurrent.TimeUnit.*; | |
public class PerformanceTimer { |
This file contains hidden or 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.lang.management.GarbageCollectorMXBean; | |
import java.lang.management.ManagementFactory; | |
import java.util.HashMap; | |
import java.util.List; | |
import java.util.Map; | |
/** | |
* Benjamin Stopford - 11/09/13 | |
*/ |
This file contains hidden or 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.benstopford.coherence.bootstrap.morecomplex; | |
import com.tangosol.io.ReadBuffer; | |
import com.tangosol.io.pof.*; | |
import com.tangosol.util.Binary; | |
import com.tangosol.util.ExternalizableHelper; | |
import java.io.IOException; | |
public class PofPrimerGist { |
This file contains hidden or 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 javax.sound.sampled.AudioFormat; | |
import javax.sound.sampled.AudioSystem; | |
import javax.sound.sampled.LineUnavailableException; | |
import javax.sound.sampled.SourceDataLine; | |
import javax.swing.*; | |
import java.awt.*; | |
import java.awt.event.KeyAdapter; | |
import java.awt.event.KeyEvent; | |
import java.util.ArrayList; | |
import java.util.Collections; |
This file contains hidden or 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.*; | |
public class TextAdventure { | |
public static void main(String[] args) { | |
new TextAdventure().run(); | |
} | |
class Question { | |
String text; |
This file contains hidden or 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 kafka.tools; | |
/* | |
* Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved. | |
* | |
* Redistribution and use in source and binary forms, with or without | |
* modification, are permitted provided that the following conditions | |
* are met: | |
* | |
* -Redistribution of source code must retain the above copyright | |
* notice, this list of conditions and the following disclaimer. |
This file contains hidden or 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.confluent.benstopford; | |
import kafka.consumer.*; | |
import kafka.javaapi.consumer.ConsumerConnector; | |
import kafka.message.MessageAndMetadata; | |
import kafka.serializer.StringDecoder; | |
import kafka.server.KafkaConfig; | |
import kafka.server.KafkaServerStartable; | |
import org.apache.curator.test.TestingServer; | |
import org.apache.kafka.clients.producer.KafkaProducer; |
This file contains hidden or 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
//Build a stream from the orders topic | |
KStream ordersStream = builder.stream(..., “orders-topic”); | |
//Build a table from the products topic, stored in a local state store called “product-store” | |
GlobalKTable productsTable = builder.globalTable(...,“product-topic”,“product-store”); | |
//Join the orders and products to do the enrichment | |
KStream enrichedOrders = ordersStream.leftJoin(productsTable, (id, order) -> order.productId,...); |
OlderNewer