Skip to content

Instantly share code, notes, and snippets.

@evazamtz
evazamtz / select2.scala
Created September 27, 2014 22:06
flexible SQL SELECT statements DSL
class Expr(expr: String) {
override def toString = expr
}
object Expr {
def apply(expr:String) = new Expr(expr)
}
object Select {
val WITH = "with"
@evazamtz
evazamtz / MyHList.scala
Created March 21, 2018 19:54
My Own HList impl
import scala.annotation.implicitNotFound
import scala.languageFeature.implicitConversions
sealed trait HHList
case class HHCons[A, B <: HHList](head: A, tail: B) extends HHList {
def ::[X](x:X): X :: A :: B = HHCons(x, this)
override def toString: String = s"$head :: $tail"
}
@evazamtz
evazamtz / explain.md
Created April 3, 2018 15:25
Tracking Snaphot Discussion

СЕЙЧАС:

В основном проекте своя таблица: public.tbl_order: (тут 16 млн заказов) id | status 1 | deliverd 2 | intransit

@evazamtz
evazamtz / explain.txt
Created April 3, 2018 15:25
Tracking Discussion
СЕЙЧАС:
=======
В основном проекте своя таблица:
public.tbl_order: (тут 16 млн заказов)
id | status
1 | deliverd
2 | intransit
@evazamtz
evazamtz / streams.sc
Created May 11, 2018 05:57
qtest Quee
import java.io.{File, FileWriter}
import scala.concurrent.{Await, Future}
import akka.actor._
import akka.stream._
import akka.stream.scaladsl._
import scala.concurrent.duration.Duration
val pw = new FileWriter(new File("C:\\temp\\hello.txt"))
@evazamtz
evazamtz / lub.scala
Created May 14, 2018 18:16
LUBConstraint
trait LUB[L <: HList, B] {
def apply(value:L):Boolean
}
object LUB {
def apply[L <: HList, B](implicit inst: LUB[L, B]): LUB[L, B] = inst
implicit def hlistLub[L <: HList, B, S0 <: HList, F0 <: HList, N <: Nat](implicit
subtype: SubtypeUnifier.Aux[L, B, S0],
filter: FilterNot.Aux[S0, B, F0],
len: Length.Aux[F0, N],
object Test {
def curry[A,B,C](f: (A, B) => C): A => (B => C) = a => f(a, _)
def uncurry[A,B,C](f: A => B => C): (A, B) => C = f(_)(_)
def compose[A,B,C](f: B => C, g: A => B): A => C = a => f(g(a))
def mul(a:Int, b:Int) = a * b
val mulC = curry(mul)
mulC(5)(10)
@evazamtz
evazamtz / lesson2.scala
Created May 21, 2018 20:11
lesson2.scala
object Test {
def curry[A,B,C](f: (A, B) => C): A => (B => C) = a => f(a, _)
def uncurry[A,B,C](f: A => B => C): (A, B) => C = f(_)(_)
def compose[A,B,C](f: B => C, g: A => B): A => C = a => f(g(a))
def mul(a:Int, b:Int) = a * b
val mulC = curry(mul)
mulC(5)(10)
@evazamtz
evazamtz / api__v2_7.yml
Created May 24, 2018 09:25
2.7 API YAML
---
# SEE: http://schemas.xmlsoap.org/wsdl/
title: PimPay Platform Api Manifest
version: 2.7
uversion: v2_7
directory: v2_7 # лежит в soap/v2_7
date: 02.09.2016
wsdl:
schemaLocation: http://platform.api.%fqdn%/v2_7/soap/wsdl
invokeLocation: http://platform.api.%fqdn%/v2_7/soap/invoke
@evazamtz
evazamtz / pattern match.scala
Created May 29, 2018 19:54
Algebraic Expr reducer
abstract class Expr
case class Var(name: String) extends Expr {
override def toString:String = s"$name"
}
case class Number(num: Double) extends Expr {
override def toString = num.toString
}
case class UnOp(operator: String, arg: Expr) extends Expr {