Skip to content

Instantly share code, notes, and snippets.

@scf37
scf37 / MockTimer.scala
Created April 16, 2024 13:55
Emulated time on Twitter Futures
import com.twitter.util.Await
import com.twitter.util.Closable
import com.twitter.util.Duration
import com.twitter.util.Future
import com.twitter.util.Promise
import com.twitter.util.Time
import scala.collection.mutable
/**
lookup 0 1 4 16 64 256 1,024 4,096 16,192 65,536 262,144 1,048,576
Set 0 ± 0% 12 ± 0% 57 ± 0% 307 ± 0% 1,410 ± 1.1% 6,200 ± 1.8% 30,500 ± 1.2% 143,000 ± 1.4% 820,000 ± 1.4% 4,510,000 ± 2.1% 42,000,000 ± 6.3%
j.ArrayList 0 ± 0% 3 ± 0% 4 ± 0% 4 ± 0% 4 ± 0% 4 ± 0% 4 ± 25.0% 3 ± 166.7% 10 ± 261.5% 90 ± 72.2% 1,000 ± 232.0% -11,000 ± 52.6%
m.Map 0 ± 0% 5 ± 0% 20 ± 0% 82 ± 1.2% 337 ± 2.1% 1,460
package bootstrap
import finecss.Dsl
trait Bootstrap0 extends Dsl {
val accordion = rule.cls("accordion")
val active = rule.cls("active")
val arrow = rule.cls("arrow")
val breadcrumb_item = rule.cls("breadcrumb-item")
package finecss.generated
import finecss.Dsl
trait TestModule20 extends Dsl {
val lead = rule.cls("lead")
.style("font-size", "1.25rem")
.style("font-weight", "300")
val display_1 = rule.cls("display-1")
@scf37
scf37 / build-info.gradle.kts
Created January 9, 2022 12:45
build-info gradle plugin, adding everything to manifest
import java.io.ByteArrayOutputStream
import java.time.ZonedDateTime
fun exec(vararg args: String) = try {
ByteArrayOutputStream().also { os ->
project.exec {
commandLine(*args)
standardOutput = os
}
}.toByteArray().let { String(it) }.trim()
@scf37
scf37 / README.md
Created October 12, 2021 19:44 — forked from Thomas-Ln/install_libffmpeg_for_opera_and_vivaldi.md
Install 'libffmpeg.so' in Vivaldi or Opera
import java.io._
/**
* Schema for efficient binary serialization of case classes
* Implementation must:
* - declare all fields using `required` and `optional` methods
* - implement doRead, transferring field values from declaration to case class instance
* - assign every field an unique tag
*
* Protocol.
package me.scf37.rediska.dao
import java.sql.Connection
import java.sql.Timestamp
import java.time.Instant
import cats.Applicative
import me.scf37.db.sql.SqlEffectLift
import me.scf37.rediska.dao.meta.Sequences
import me.scf37.rediska.dao.meta.Tables.USER
@scf37
scf37 / TethysDyn.scala
Created August 13, 2019 20:56
Tethys Json via reflection
package me.scf37.json
import java.lang.reflect.Field
import java.lang.reflect.ParameterizedType
import java.lang.reflect.Type
import java.util.concurrent.ConcurrentHashMap
import me.scf37.fine.exception.JsonParsingException
import tethys.JsonReader
import tethys.JsonWriter
package bootstrap
import me.scf37.finecss.Dsl
trait Bootstrap0 extends Dsl {
val accordion = rule.cls("accordion")
val active = rule.cls("active")
val arrow = rule.cls("arrow")
val breadcrumb_item = rule.cls("breadcrumb-item")