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
{-# LANGUAGE FlexibleInstances, GeneralizedNewtypeDeriving #-} | |
newtype TimeUnit = TimeUnit Integer -- how many microseconds | |
deriving (Eq, Show, Num) | |
instance Num (TimeUnit -> TimeUnit) where | |
fromInteger n = \(TimeUnit scale) -> TimeUnit (n * scale) | |
-- a + b = ... -- task for you |
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 Data.Char | |
strong = and . sequence conditions | |
where conditions = [ (>14) . length | |
, any isUpper | |
, any isLower | |
, any isDigit | |
] | |
{- |
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 util | |
import scalaz.effect.IO | |
import scalaz._ | |
import Scalaz._ | |
import scala.concurrent.stm.{ retry => stmRetry, _ } | |
object X { | |
type STM[+A] = ReaderT[IO, InTxn, A] |
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 javax.jws.WebService | |
import javax.jws.soap.SOAPBinding | |
import javax.jws.soap.SOAPBinding.Style | |
import javax.xml.ws.Endpoint | |
@WebService(targetNamespace="org.scalabound.test", name="org.scalabound.test", portName="test", serviceName="WSTest") | |
private class MinimalSoapServer { | |
@SOAPBinding(style = Style.RPC) | |
def test(value : String) = "Hi " + 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
def treeDoc(t: Tree): Doc = t match { | |
case PackageDef(mods, pid, xs) => mods <> "package" <+> pid <+> xs.inBracesBlock | |
case Import(expr, selectors) => "import" <+> expr <> dot <> selectors | |
case NamedImport(name) => name | |
case TypeIdent(pre, name) => (pre :+ name).joinDotted | |
case TermIdent(pre, name) => (pre :+ name).joinDotted | |
case ClassDef(mods, keyword, name, tparams, vparamss, impl) => linebreak <> mods <> keyword <+> name <> tparams <> tight(vparamss) <> doTemplate(line <> "extends", impl) | |
case TypeParam(mods, name, tparams, constraints) => mods <> name <> tparams <> constraints | |
case ValueParam(mods, name, tpt, defaultValue) => mods <> name <> tpt <> opt(space <> assign, defaultValue) | |
case x: Name => x.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 class GetEventStoreEventDispatcher | |
{ | |
private const int RECONNECT_TIMEOUT_MILLISEC = 5000; | |
private const int THREAD_KILL_TIMEOUT_MILLISEC = 5000; | |
private const int READ_PAGE_SIZE = 500; | |
private const int LIVE_QUEUE_SIZE_LIMIT = 10000; | |
private readonly IEventBus _eventBus; | |
private readonly EventStoreConnection _store; |
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 akka.kafka.scaladsl | |
import java.util.concurrent.TimeUnit | |
import java.util.{Properties, UUID} | |
import akka.actor.ActorSystem | |
import akka.kafka.{ConsumerSettings, ProducerSettings} | |
import akka.stream.ActorMaterializer | |
import akka.stream.scaladsl.Sink | |
import akka.testkit.TestKit |
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 cats.bench | |
import cats.data.Xor | |
import cats.instances.either._ | |
import cats.syntax.all._ | |
import org.openjdk.jmh.annotations.{ Benchmark, Scope, State } | |
@State(Scope.Benchmark) | |
class EitherBench { | |
val ea: Either[String, Int] = Right(1) |
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
/* | |
* Copyright (c) 2015 Miles Sabin | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Unless required by applicable law or agreed to in writing, software |
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
/** | |
* Single-file play framework application! Make sure everything | |
* works, as this is the test case that un-earthed #371 | |
*/ | |
load.ivy("com.typesafe.play" %% "play" % "2.5.0") | |
load.ivy("com.typesafe.play" %% "play-netty-server" % "2.5.0") | |
load.ivy("org.scalaj" %% "scalaj-http" % "2.2.1") | |
@ |
OlderNewer