Skip to content

Instantly share code, notes, and snippets.

View minosiants's full-sized avatar
💫
Я не волшебник. Я только учусь.

Kaspar Minosiants minosiants

💫
Я не волшебник. Я только учусь.
View GitHub Profile
@minosiants
minosiants / Eval.scala
Created March 4, 2017 02:10
Evaluating string as scala code using twitter util-eval
// https://github.com/twitter/util
object Programm extends App {
import com.twitter.util.Eval
type EntryConditionFunc = Map[String, String] => Boolean
val eval = new Eval
val func = eval[EntryConditionFunc]("""(ctx:Map[String, String]) => ctx("name") == "hello" """)
@minosiants
minosiants / gist:9891317
Last active August 29, 2015 13:57
How to inline font icons into css

Goal: inline fonts icons to speed up page load

In my case I used only 4 icons from http://fortawesome.github.io/Font-Awesome/ so it's not efficient to include the whole bunch of fortawesome files

  1. At http://fontello.com/ selects required icons and export them.

  2. Encode required font file (.eot .svg .woff .ttf) into base64

Linux example
@minosiants
minosiants / gist:5696585
Created June 3, 2013 07:27
Scalaz Endo
//https://github.com/debasishg/scala-snippets/blob/master/src/main/scala/endofluent.scala
//http://debasishg.blogspot.com.au/2013/02/a-dsl-with-endo-monoids-for-free.html
object Somescala extends App {
// import endodsl._
// val now = Calendar.getInstance.getTime
// val p =
// project("xenos", now) {
// for {
// a <- task("study requirements")
// b <- task("do analysis")
@minosiants
minosiants / gist:5618046
Created May 21, 2013 07:19
Find value in vector of vectors
@tailrec
def find[A](value:A, v:Vector[Vector[A]]):Option[A]={
v.head.find(_==value) match {
case Some(i) => Some(i)
case None if v.size==1 => None
case None => find(value,v.tail)
}
}
@minosiants
minosiants / gist:3163791
Created July 23, 2012 14:06
Akka EventBus simple example
package com.minosiants
import akka.event.ActorEventBus
import akka.event.LookupClassification
import akka.actor.ActorSystem
import akka.actor.Props
import akka.actor.Actor
import java.util.Date
import java.util.UUID