Skip to content

Instantly share code, notes, and snippets.

View pshirshov's full-sized avatar
😹

Paul S. pshirshov

😹
View GitHub Profile
@pshirshov
pshirshov / PrefixTree.scala
Created October 31, 2019 15:38
Simple prefix search tree (trie)
case class PrefixTree[K, V](values: Seq[V], children: Map[K, PrefixTree[K, V]]) {
def findSubtree(prefix: List[K]): Option[PrefixTree[K, V]] = {
prefix match {
case Nil =>
Some(this)
case head :: tail =>
children.get(head).map(_.findSubtreeOrRoot(tail))
}
}
@pshirshov
pshirshov / Markdium-Scala.scala
Created October 8, 2019 08:31
Markdium-Monorepo or Multirepo? Role-Based Repositories
lazy val conditionalProject = if (condition) {
project.in(...)
} else {
null
}
@pshirshov
pshirshov / Markdium-Shell.bash
Created October 8, 2019 08:31
Markdium-Monorepo or Multirepo? Role-Based Repositories
# generates pure JVM project
./sbtgen.sc
# generates JVM/JS cross-project
./sbtgen.sc --js
# generates pure JVM project for just one of our components
./sbtgen.sc -u distage
@pshirshov
pshirshov / Markdium-Shell.bash
Created October 8, 2019 08:31
Markdium-Monorepo or Multirepo? Role-Based Repositories
# Prepares workspace for all our components
project prepare *
# Prepares workspace to work on `billing` and `analytics`
# Pulls in `sdk` as well
project prepare +billing +analytics
# Prepares workspace to work on `sdk`, `iam` and `catalog`
project prepare :infrastructure
@pshirshov
pshirshov / Markdium-Shell.bash
Created October 7, 2019 19:27
Markdium-Monorepo or Multirepo? Role-Based Repositories
# Prepares workspace for all our components
project prepare *
# Prepares workspace to work on `billing` and `analytics`
# Pulls in `sdk` as well
project prepare +billing +analytics
# Prepares workspace to work on `sdk`, `iam` and `catalog`
project prepare :infrastructure
@pshirshov
pshirshov / Markdium-Shell.bash
Created October 7, 2019 19:27
Markdium-Monorepo or Multirepo? Role-Based Repositories
# generates pure JVM project
./sbtgen.sc
# generates JVM/JS cross-project
./sbtgen.sc --js
# generates pure JVM project for just one of our components
./sbtgen.sc -u distage
@pshirshov
pshirshov / Markdium-Scala.scala
Created October 7, 2019 19:27
Markdium-Monorepo or Multirepo? Role-Based Repositories
lazy val conditionalProject = if (condition) {
project.in(...)
} else {
null
}
# bad: [aa1427a6c35aa832d50f729345783351bc5eaea1] update heap parameter tests to respect disabling of sbt super shell. #SCL-15643
# good: [490d7efd7ed1539dd97bab9711110c19eee201c8] Merge pull request #466 from ingarabr/scalafmt-file-save-bug
git bisect start 'aa1427a6c35aa832d50f729345783351bc5eaea1' '490d7efd7ed1539dd97bab9711110c19eee201c8'
# skip: [977e9d32742fda20cb28cdcc1d444b80a967e1ff] TypeDiff: "flatten" insted of "format"
git bisect skip 977e9d32742fda20cb28cdcc1d444b80a967e1ff
# skip: [7137cd9a73476f1296828d8c35fd9925de40f193] Type mismatch hints: tooltips and navigation
git bisect skip 7137cd9a73476f1296828d8c35fd9925de40f193
# bad: [f7bedf958b260a6a5cf3ac2bcaf9c20ac38f1441] BSP: shared modules: heuristic: synthetic shared source modules depend on their parent's dependencies, but not on their parents directly. synthetic modules do not export their dependencies.
git bisect bad f7bedf958b260a6a5cf3ac2bcaf9c20ac38f1441
# bad: [db650c486ee247b88681ef57b647059979d9fa9a] Added OverrideAbstractMemberInspe
@pshirshov
pshirshov / light_type_tags.scala
Last active July 24, 2019 00:35
Runtime reflection free type tags PoC
package com.github.pshirshov.izumi.fundamentals.reflection
import com.github.pshirshov.izumi.fundamentals.reflection.LightTypeTag.{AbstractKind, AbstractReference, Boundaries, FullReference, Hole, Kind, NameReference, Variance}
import scala.language.experimental.macros
import scala.language.higherKinds
import scala.reflect.macros.blackbox
trait ALTT {
def t: LightTypeTag
trait Fake
def materialize1[T[_]]: LightTypeTag = macro TypeTagExampleImpl.makeTag[T[Fake]]
def makeTag[T: c.WeakTypeTag]: c.Expr[LightTypeTag] = {
import c._
val wtt = implicitly[WeakTypeTag[T]]
println(wtt)
???
}