Skip to content

Instantly share code, notes, and snippets.

View OndrejSpanel's full-sized avatar

Ondřej Španěl OndrejSpanel

  • Czech Republic
  • 14:24 (UTC +02:00)
View GitHub Profile
@OndrejSpanel
OndrejSpanel / JacksonMapTest.scala
Last active August 29, 2015 14:24 — forked from crimsoncor/JacksonMapTest.scala
Updated Broken Scala Map to JSON to match recent package naming and language style
package test
import com.fasterxml.jackson.databind.ObjectMapper
import com.fasterxml.jackson.module.scala.DefaultScalaModule
object Main extends App {
val mapper = new ObjectMapper()
mapper.registerModule(DefaultScalaModule)
@OndrejSpanel
OndrejSpanel / HashTest.scala
Created February 6, 2016 21:40
Test builder vs. update performance for HashMap
object HashTest extends App {
import scala.collection.generic.CanBuildFrom
import scala.collection.immutable.HashMap
type HM = HashMap[Int, String]
def updated(map: HM, key: Int, value: String) = {
map.updated(key, value)
}
def builder(m: HM, key: Int, value: String)(implicit cbf: CanBuildFrom[HM, (Int, String), HM]) = {
@OndrejSpanel
OndrejSpanel / BorerAnyKey.scala
Created April 8, 2024 10:37
Use non-string types as Borer Json key
import io.bullet.borer._
object BorerAnyKey {
trait MapKeyCodec[K] {
def keyToString(k: K): String
def keyFromString(s: String): K
}
implicit object MapKeyCodecString extends MapKeyCodec[String] {
override def keyToString(k: String): String = k
@OndrejSpanel
OndrejSpanel / assertFailed-stack.log
Created May 18, 2024 09:04
assertFailed:8, Scala3RunTime$ (scala.runtime)
assertFailed:8, Scala3RunTime$ (scala.runtime)
classSymbol:1277, ClassfileParser$innerClasses$ (dotty.tools.dotc.core.classfile)
classNameToSymbol:320, ClassfileParser (dotty.tools.dotc.core.classfile)
getClassSymbol:1365, ClassfileParser (dotty.tools.dotc.core.classfile)
getClassSymbol:1326, ClassfileParser$ConstantPool (dotty.tools.dotc.core.classfile)
getSuperClass:176, ClassfileParser$AbstractConstantPool (dotty.tools.dotc.core.classfile)
parseParents$1:380, ClassfileParser (dotty.tools.dotc.core.classfile)
parseClass:395, ClassfileParser (dotty.tools.dotc.core.classfile)
$anonfun$1:302, ClassfileParser (dotty.tools.dotc.core.classfile)
apply:-1, ClassfileParser$$Lambda/0x0000022457055760 (dotty.tools.dotc.core.classfile)