I hereby claim:
- I am speedcom on github.
- I am mmaciaszek (https://keybase.io/mmaciaszek) on keybase.
- I have a public key whose fingerprint is 5869 5C6A 1B54 8356 6273 CFDF 8CC5 3EDC 0017 5187
To claim this, I am signing this object:
import scala.collection.mutable.Stack | |
val equation = "12 2 3 4 * 10 5 / + * +" | |
val ops = equation.split(" ") | |
val stack = new Stack[Int]() | |
def *(a: Int, b: Int) = a * b | |
def /(a: Int, b: Int) = a / b | |
def +(a: Int, b: Int) = a + b |
I hereby claim:
To claim this, I am signing this object:
val cache = Ref[List[Int]](Nil) | |
val needUpdate = Ref[Boolean](true) | |
def getOrUpdate = atomic { implicit txn => | |
if(needUpdate()) { | |
asyncCallingToWebservice().map { data => | |
cache() = data | |
needUpdate() = false | |
data |
package models.error | |
import org.scalactic._ | |
import scala.concurrent.{ExecutionContext, Future} | |
import org.scalactic.Accumulation._ | |
trait Error | |
object FutureOr { | |
type Errors = Every[Error] |
sealed trait Mark | |
case object Circle extends Mark | |
case object Cross extends Mark | |
case class Board(array: Array[Array[Mark]]) { | |
lazy val cols: Array[Array[Mark]] = { | |
val col1 = Array(array(0)(0), array(1)(0), array(2)(0)) | |
val col2 = Array(array(0)(1), array(1)(1), array(2)(1)) |
import java.util.concurrent.ThreadPoolExecutor.AbortPolicy | |
import java.util.concurrent._ | |
import scala.concurrent.{ Promise, Future } | |
import scala.concurrent.duration.FiniteDuration | |
import scala.language.implicitConversions | |
import scala.util.Try | |
object ScheduledExecutor { | |
private val defaultHandler: RejectedExecutionHandler = new AbortPolicy |
/** A for comprehension ready Monad */ | |
case class Focomo[A](value: A) { | |
self => | |
/** satisfies monadic binding of a function f that returns B */ | |
def map[B](f: A => B): Focomo[B] = { | |
println("map!"); | |
Focomo(f(value)) | |
} | |
/** satisfies monadic binding of a function f that returns Focomo[B] */ | |
def flatMap[B](f: A => Focomo[B]): Focomo[B] = { |
object ReadSample extends App { | |
/** | |
* The readable trait defines how objects can be converted from a string | |
* representation to the objects instance. For most of the standard types | |
* we can simply use the toType function of String. | |
*/ | |
trait Readable[T] { | |
def read(x: String): T | |
} |
package Boot | |
import akka.actor.{Cancellable, Actor, ActorSystem, Props} | |
import akka.stream.{OverflowStrategy, ActorFlowMaterializer} | |
import akka.stream.actor.ActorSubscriberMessage.{OnComplete, OnNext} | |
import akka.stream.actor.{ActorSubscriber, OneByOneRequestStrategy, RequestStrategy} | |
import akka.stream.scaladsl._ | |
import org.akkamon.core.exporters.StatsdExporter | |
import org.akkamon.core.instruments.{CounterTrait, LoggingTrait, TimingTrait} |
// implicit conversion from one type to another one | |
// 1 way | |
object ViewBound { | |
trait Show { | |
def show: String | |
} | |
object Show { |