I hereby claim:
- I am fomkin on github.
- I am fomkin (https://keybase.io/fomkin) on keybase.
- I have a public key whose fingerprint is 6BEE BA4C 8D4C 6826 0A5D 4253 1125 8561 B6FA 7169
To claim this, I am signing this object:
| final class JavaTimerScheduler { | |
| private val timer = new Timer() | |
| def scheduleOnce[T](delay: FiniteDuration)(job: => T)(implicit ec: ExecutionContext): JobHandler[T] = { | |
| val promise = Promise[T] | |
| val task = new TimerTask { | |
| def run(): Unit = { | |
| Future { | |
| val result = job // Execute a job |
| case class BTree[K, V](root: BTree.Node[K, V], order: Int)(implicit keyOrdering: Ordering[K]) { | |
| import keyOrdering.mkOrderingOps | |
| private type N = BTree.Node[K, V] | |
| private type E = BTree.Entry[K, V] | |
| def get(key: K): Option[V] = { | |
| def aux(node: N): Option[V] = { | |
| val mayBeEntry = node.entries.find(_.key == key) |
| case class Style(xs: Map[String, String]) { | |
| def +(s: Style) = Style(xs ++ s.xs) | |
| def mkString = xs | |
| .map { case (k, v) => s"$k: $v;" } | |
| .mkString(" ") | |
| } | |
| object Style { |
| /* | |
| Copyright 2012 Viktor Klang | |
| 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 |
| import shapeless._ | |
| import shapeless.nat._ | |
| import shapeless.ops.nat.GT._ | |
| import shapeless.ops.nat.GTEq._ | |
| import shapeless.ops.nat._ | |
| import shapeless.syntax.sized._ | |
| import scala.collection.mutable | |
| /** |
I hereby claim:
To claim this, I am signing this object:
| var bb = new Blob([` | |
| onmessage = function(e) { | |
| postMessage('pong'); | |
| }; | |
| postMessage('started'); | |
| `]); | |
| var worker = new Worker(window.URL.createObjectURL(bb)); | |
| var startTime = -1; |
| def evenlyDivisibleBy(divider: Int): Int ^^ Int = Extractor { | |
| case n if n % divider == 0 => n | |
| } | |
| val evenlyDivisibleByFive = evenlyDivisibleBy(5) | |
| val evenlyDivisibleByThree = evenlyDivisibleBy(3) | |
| val evenlyDivisibleByFifteen = evenlyDivisibleBy(15) | |
| def fizzbuzz(x: Int) = x match { | |
| case evenlyDivisibleByFifteen(_) => "fizzbuzz" |
Русскоязычный канал по Scala.
Не размещайте ссылки на вакансии, если:
В чате действует Code of Conduct. https://www.scala-lang.org/conduct/
Флудить можно в меру.
| trait Async[F[_]] { | |
| def pure[A](value: => A): F[A] | |
| def promise[A]: Async.Promise[F, A] | |
| def flatMap[A, B](m: F[A])(f: A => F[B]): F[B] | |
| def map[A, B](m: F[A])(f: A => B): F[B] | |
| def run[A, U](m: F[A])(f: Try[A] => U): Unit | |
| } | |
| object Async { | |
| case class Promise[F[_], A](future: F[A], complete: Try[A] => Unit) |