Skip to content

Instantly share code, notes, and snippets.

View optician's full-sized avatar
🦉

Danila Matveev optician

🦉
  • Yerevan, Armenia
View GitHub Profile
@optician
optician / tofu_docs.md
Last active February 12, 2020 06:58
Tofu docs (community edition)

Tofu docs (community edition)

Memo

Dependency

It is in the core Tofu dependency - "ru.tinkoff" %% "tofu" % "0.7.0".

Functionality

  • A cache of a single value on access.
  • A cache of a values mapping on access.
@optician
optician / basics.v
Created March 6, 2019 03:55
basics, 3 stars task
Theorem andb_true_id :
forall a : bool, a = andb true a.
Proof.
intros []; reflexivity.
Qed.
Theorem orb_false_id :
forall a : bool, a = orb false a.
Proof.
intros []; reflexivity.
import cats.effect.concurrent.Ref
import cats.effect.{IO, Sync}
import cats._
import cats.implicits._
import fs2.Stream
def g(r: => IO[Ref[IO, Int]]): Stream[IO, Int] =
Stream
.eval(r)
.flatMap(
project.git = true
maxColumn = 120
lineEndings = unix
docstring = "ScalaDoc"
assumeStandardLibraryStripMargin = true
continuationIndent.callSite = 2
continuationIndent.defnSite = 4
style = defaultWithAlign
scala> object A1 { val a = 5 }
defined object A1
scala> object A2 { final val a = 5 }
defined object A2
scala> :javap A1$
Size 640 bytes
MD5 checksum 0d6b181ccd3f32e7e81a7f452b2f5686
Compiled from "<console>"
@optician
optician / scalac.scala
Created March 23, 2018 08:10
PartialFunction.scala
class A{
val x: PartialFunction[Any, Int] = {
case Some(x: Int) => x
}
}
@optician
optician / py-vs-haskell.scala
Created October 23, 2017 06:53
scala/java version. About 11sec
import scala.io._
import java.io._
import scala.collection.mutable.ArrayBuffer
object Main {
def main(args: Array[String]): Unit = {
var i = 0
var v1: ArrayBuffer[String] = new ArrayBuffer(10000)
var v2: ArrayBuffer[String] = new ArrayBuffer(10000)
Source.stdin.getLines.foreach{
@optician
optician / gist:1f620045ad6ee4fce634b4f0e64fb27e
Created December 11, 2016 11:32 — forked from debasishg/gist:8172796
A collection of links for streaming algorithms and data structures
  1. General Background and Overview
import pushka.json._
import pushka.annotation._
// First case.
// Simple as is.
@pushka
case class A(subModel: B, i: Int, str: String)
@pushka
case class B(field1: Int, field2: List[Int])
import org.scalameter._
import scala.concurrent.ExecutionContext.Implicits.global
import scala.concurrent.duration.Duration
import scala.concurrent.{Await, ExecutionContext, Future}
object Main {
/*