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 objectx.WeightedPoint | |
| import objects.Pair | |
| import org.scalacheck.Arbitrary | |
| import org.scalatest.FreeSpec | |
| import org.scalatest.matchers.MustMatchers | |
| import org.scalatest.prop.Checkers | |
| class PartitionCheck extends FreeSpec with Checkers with MustMatchers { |
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 scalawebapp | |
| import com.sun.net.httpserver.{HttpExchange, HttpHandler, HttpServer} | |
| import java.net.InetSocketAddress | |
| import scala.concurrent.Future | |
| import scala.concurrent.ExecutionContext.Implicits.global | |
| import scala.util.{Failure, Success} | |
| class MyHttpServer(port: Int = 8080) { |
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 org.junit.Ignore; | |
| import org.junit.Test; | |
| import java.util.*; | |
| public class SortTest { | |
| @Test | |
| public void testCollectionsSort() { | |
| List<Integer> values = getValues(); |
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
| from maybe import Maybe | |
| from validation import Validation | |
| def Typeclass(): | |
| class _Typeclass(object): | |
| registered_class = {} | |
| @classmethod | |
| def instance_for(cls, object_type): |
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
| private static final Map<String, $CLASS_NAME$> $VAR_CLASS_NAME$sByName = create$CLASS_NAME$sByName(); | |
| private final String name; | |
| $CLASS_NAME$() { | |
| this(null); | |
| } | |
| $CLASS_NAME$(String name) { | |
| this.name = name; |
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
| object FunctorModule { | |
| trait Functor[F[_]] { | |
| def map[A, B](f: A => B): F[A] => F[B] | |
| } | |
| implicit class ReaderFunctor[E](r: E => _) extends Functor[({ type l[a] = E => a })#l] { | |
| override def map[A, B](f: A => B): (E => A) => (E => B) = { r => r andThen f } | |
| } |
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 org.junit.Test; | |
| import java.util.Arrays; | |
| import java.util.List; | |
| public class GenericsTest { | |
| @Test | |
| public void should_convert___well_huh() throws Exception { |
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 me; | |
| import java.util.Collection; | |
| import java.util.function.Function; | |
| public interface ClassToRefactor_Copy { | |
| default void sendMessages(Collection<ParseResult<InputMessage>> parsedMessages) { | |
| parsedMessages.stream() | |
| .map(parsedMessage -> |
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.function.Function; | |
| public interface Continuation<R, A> extends Function<Function<A, R>, R> { | |
| @Override | |
| R apply(Function<A, R> f); | |
| default <B> Continuation<R, B> map(Function<A, B> f) { | |
| return continuation(g -> apply(g.compose(f))); | |
| } |
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
| libraryDependencies ++= Seq( | |
| "org.springframework.data" % "spring-data-mongodb" % "1.7.2.RELEASE", | |
| "org.springframework.boot" % "spring-boot-autoconfigure" % "1.2.5.RELEASE" | |
| ) |