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 CassandraWrapper { | |
import scala.language.implicitConversions | |
import scala.language.postfixOps | |
/** | |
* Converts a `ResultSetFuture` into a Scala `Future[ResultSet]` | |
* @param f ResultSetFuture to convert | |
* @return Converted Future | |
*/ | |
implicit def resultSetFutureToScala(f: ResultSetFuture): Future[ResultSet] = { | |
val p = Promise[ResultSet]() |
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
1/18 : Encode single Seq[Int] | |
============================= | |
Library ops/s % size % size.gz % | |
BooPickle 146324 8.4% 2 100% 32 100% | |
Prickle 231064 13.2% 27 1350% 58 181% | |
uPickle 245188 14.1% 3 150% 35 109% | |
Circe 962996 55.2% 3 150% 35 109% | |
Pushka 1744486 100.0% 3 150% 35 109% | |
2/18 : Decode single Seq[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
class ZipModelR[M, S, SS](root: ModelR[M, M], get1: M => S, get2: M => SS)(implicit cts: ClassTag[S], ctss: ClassTag[SS]) extends ModelR[M, (S, SS)] { | |
private var zipped = Tuple2[S, SS](null.asInstanceOf[S], null.asInstanceOf[SS]) | |
// ZipModel uses optimized `get` functions to compare if the contents of the tuple has changed or not | |
// Different comparison functions are used for boxed values and real references | |
private def getXX(compS: (S, S) => Boolean, compSS: (SS, SS) => Boolean)(model: M) = { | |
// check if inner references have changed | |
val v1 = get1(root.value) | |
val v2 = get2(root.value) | |
if (compS(zipped._1, v1) || compSS(zipped._2, v2)) { |
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 math._ | |
val (h, w) = (Page.canvas.height, Page.canvas.width) | |
var x = 0.0 | |
// $FiddleStart | |
val graphs = Seq[(String, Double => Double)]( | |
("red", sin), | |
("green", x => 2 - abs(x % 8 - 4)), | |
("blue", x => 3 * pow(sin(x / 12), 2) * sin(x)) | |
) | |
// $FiddleEnd |
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
.room-list-item__unread-badge { | |
color: black; | |
} | |
pre code { | |
text-rendering: optimizeLegibility; | |
font-family: Hasklig, monospace; | |
} |
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 scala.tools.nsc.interactive, scala.tools.nsc.reporters._, scala.tools.nsc._ | |
object Test { | |
def main(args: Array[String]): Unit = { | |
val reporter = new StoreReporter | |
val s = new Settings() | |
s.processArgumentString("-Ypresentation-any-thread") | |
val global = new interactive.Global(s, reporter) | |
import global._ | |
val Cursor = ""//"_DUMMY_ " |
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
// $FiddleDependency org.scala-js %%% scalajs-dom % 0.9.0 | |
// $FiddleDependency com.lihaoyi %%% scalatags % 0.5.4 | |
import scalatags.JsDom.all._ | |
import org.scalajs.dom | |
import fiddle.Fiddle, Fiddle.println | |
import scalajs.js | |
object ScalaFiddle extends js.JSApp { | |
def main() = { | |
// $FiddleStart |
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 com.amazonaws.HttpMethod | |
import com.amazonaws.services.s3.AmazonS3Client | |
import com.amazonaws.services.s3.model._ | |
... | |
val s3Client = new AmazonS3Client | |
private def getFlow(pathRaw: String, method: HttpMethod) = { | |
// clean the path | |
val path = pathRaw.dropWhile(_ == '/').trim |
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 poc | |
import org.scalajs.dom | |
import scala.scalajs.js | |
import scala.scalajs.js.annotation.JSExport | |
@js.native | |
object WorkerGlobal extends js.GlobalScope { | |
def addEventListener(`type`: String, f: js.Function): Unit = js.native |
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
"Macau", | |
"Macedonia", | |
"Madagascar", | |
"Malawi", | |
"Malaysia", | |
"Maldives", | |
"Mali", | |
"Malta", | |
"Marshall Islands", | |
"Mauritania", |
OlderNewer