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
** Working */ | |
sealed class AB[+A] protected(protected val in: List[A], protected val out: List[A]) | |
object AB { | |
class ABC(override protected val in: List[Int], | |
override protected val out: List[Int]) | |
extends AB(in, out) | |
} | |
/**Not Working*/ | |
sealed class AB[+A] protected(protected val in: List[A], protected val out: List[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
trait Named[E] { | |
val name: String | |
} | |
case class EOL() | |
implicit val namedInt = new Named[Int] { | |
override val name: String = "Int" | |
} |
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 fun: ((Int, Int)) => Int = (kv: Tuple2[Int, Int]) => kv match { | |
case (k, v) => k + v | |
} | |
val fun1: Function1[Tuple2[Int, Int], Int] = (kv: Tuple2[Int, Int]) => kv match { | |
case (k, v) => k + v | |
} | |
val myMap = Map(1 -> 2, 2 -> 3) | |
myMap.map(fun) |
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
@js.native | |
trait Auth extends js.Object { | |
val byToken: js.UndefOr[LoginWithSSOToken] = js.undefined | |
val byCredentials: js.UndefOr[LoginWithPlainText] = js.undefined | |
} | |
object Auth { | |
def apply(authType: AuthType): Auth = authType match { | |
case byToken: LoginWithSSOToken => js.Dynamic.literal(byToken = byToken).asInstanceOf[Auth] | |
case byCredentials: LoginWithPlainText => js.Dynamic.literal(byCredentials = byCredentials).asInstanceOf[Auth] |
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
```javascript | |
{ | |
"title":"Report Properties", | |
"description":"A JSON Schema describing a Report Properties", | |
"$schema":"http://json-schema.org/draft-04/schema#", | |
"type":"object", | |
"properties":{ | |
"server":{ | |
"type":"string", | |
"description":"URL of JRS instance." |
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 java.nio.ByteBuffer | |
import java.security.MessageDigest | |
import javax.xml.bind.DatatypeConverter | |
import akka.actor.ActorSystem | |
import akka.http.scaladsl.Http | |
import akka.http.scaladsl.model.HttpMethods.GET | |
import akka.http.scaladsl.model.{HttpRequest, HttpResponse} | |
import akka.stream.ActorMaterializer | |
import akka.stream.scaladsl.{Flow, Keep, Sink} |
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
{ | |
type: 'devs.Model', | |
inPorts: [], | |
outPorts: [], | |
size: { | |
width: 80, | |
height: 80 | |
}, | |
attrs: { |
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
Html: | |
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Title</title> | |
<script src="https://code.jquery.com/jquery-3.2.1.min.js"></script> | |
<script type="text/javascript"> | |
Office = { | |
initialize: function (reason) { |
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
trait Item | |
trait PlasticItem extends Item | |
trait PlasticBottle extends PlasticItem | |
trait PaperItem extends Item | |
trait NewsPaper extends PaperItem |
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
sealed trait A | |
case class B[Req, Res](r: Req, rs: Res) extends A | |
case class C[Req](r: Req, errorCode: Int, errorMessage: String) extends A | |
trait TypeA[Req, Res] { | |
def success(t: Req, r: Res): Unit | |
def error(t: Req): Unit | |
} | |
implicit val forString = new TypeA[String, String] { | |
override def success(t: String, r: String): Unit = ??? |