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
object SuppliedSemigroup { | |
import cats.kernel.Semigroup | |
implicit val maxDurationSemigroup: Semigroup[Duration] = Semigroup((a, b) => if (a > b) a else b) | |
// implicit val optionMonoid: Monoid[Option[Duration]] = cats.kernel.instances.option.catsKernelStdMonoidForOption(maxDurationSemigroup) | |
def optionDurationCombineSemigroup(rp1: Option[Duration], rp2: Option[Duration])(implicit mo: Semigroup[Option[Duration]]): Option[Duration] = { | |
mo.combine(rp1, rp2) | |
} |
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
object Precendence { | |
import cats.Monoid | |
import cats.kernel.Semigroup | |
import cats.instances.duration._ // <==== comment this out to see the difference | |
implicit val maxDurationSemigroup: Semigroup[Duration] = Semigroup((a, b) => if (a > b) a else b) | |
implicit def optionMonoid[A](implicit ev: Semigroup[A]): Monoid[Option[A]] = | |
new Monoid[Option[A]] { | |
def empty: Option[A] = None | |
def combine(x: Option[A], y: Option[A]): Option[A] = | |
x match { |
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
@DoNotDiscover | |
class Test1 | |
extends FeatureSpecLike | |
with Logging | |
{ | |
feature("main feature") { | |
logger.info("starting main feature") | |
scenario("do stuff") { | |
logger.info("doing some stuff here yo") |
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 akka.actor._ | |
import akka.routing.{Broadcast, RoundRobinRouter} | |
import scala.Some | |
// CONNECTION | |
case class Connection(production: Boolean = false, id: Int) { | |
def doStuff(stuff: String) = println(s"stuff [${stuff}] is being done") | |
} | |
trait ConnectionProvider { |
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
val map = Map[String, () => Unit]("a" -> proc1, "b" -> proc2) | |
def proc1() { | |
println("doing stuff") | |
} | |
def proc2() { | |
println("doing other stuff") | |
} |
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
implicit def serviceRequest2GeneratedMessage[R <: ServiceResponse, T <: GeneratedMessage](response: R): T = { | |
response match { | |
case p:PlayerRegisterResponse => return someFunctionThatMapsToGeneratedMessageDerivedClass(p) | |
} | |
} |
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 sbt._ | |
import Keys._ | |
import sbtprotobuf.{ProtobufPlugin=>PB} | |
object MyBuild extends Build { | |
lazy val root = Project( | |
id = "toastyphoenix", | |
base = file("."), | |
settings = Defaults.defaultSettings ++ PB.protobufSettings ++ Seq( | |
version := "2.5.0" |
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 MyClass | |
attr_accessor :vara, :varb | |
def initialize(hash) | |
@vara = hash[:vara] | |
@varb = hash[:varb] | |
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
procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu----- | |
r b swpd free buff cache si so bi bo in cs us sy id wa st | |
1 0 30100 10820 21460 730368 0 0 0 0 87 208 0 1 99 0 0 | |
0 0 30100 10820 21460 730368 0 0 0 0 101 248 0 0 100 0 0 | |
2 0 30100 10820 21460 730368 0 0 0 0 96 214 0 0 100 0 0 | |
1 0 30100 10820 21460 730368 0 0 0 0 97 223 0 0 100 0 0 | |
0 1 30100 10292 21460 730400 0 0 32 0 122 257 0 1 84 15 0 | |
4 1 30100 10624 21200 729308 0 0 0 0 150 152 0 5 0 95 0 | |
30 1 30100 10664 21200 729308 0 0 0 0 354 40 0 83 0 17 0 | |
30 1 30100 10768 21016 728892 0 0 0 0 386 88 1 94 0 6 0 |