Skip to content

Instantly share code, notes, and snippets.

View kubukoz's full-sized avatar
😱
I might take a week to respond. Or a month.

Jakub Kozłowski kubukoz

😱
I might take a week to respond. Or a month.
View GitHub Profile
@kubukoz
kubukoz / gadthelp.scala
Last active February 6, 2021 01:03 — forked from matfournier/gadthelp.scala
gadthelp
trait AA
trait AA1
trait BB
trait BB1
trait HasScenarios[A, B] {
def scenarios: Map[String, Scenario[A, B]]
}
import cats.effect.Concurrent
import cats.syntax.flatMap._
import cats.syntax.functor._
import cats.effect.concurrent.Semaphore
trait CountDownLatch[F[_]] {
def countDown: F[Unit]
def await: F[Unit]
}
diff --git a/mtags/src/main/scala/scala/meta/internal/pc/AutoImports.scala b/mtags/src/main/scala/scala/meta/internal/pc/AutoImports.scala
index 34c7258..11f34b6 100644
--- a/mtags/src/main/scala/scala/meta/internal/pc/AutoImports.scala
+++ b/mtags/src/main/scala/scala/meta/internal/pc/AutoImports.scala
@@ -37,14 +37,14 @@ trait AutoImports { this: MetalsGlobal =>
}
}
+ def isImportPosition: Boolean =
+ findLastVisitedParentTree(pos).exists(_.isInstanceOf[Import])
@kubukoz
kubukoz / SlickRunIO.scala
Last active January 14, 2019 16:58
SlickRunIO.scala
trait SlickRunIOImplicits { self: API =>
implicit class SlickRunIO(db: Database) {
/** Return an effect that runs a DB action. */
def runIO[R](a: DBIOAction[R, NoStream, Nothing])(implicit cs: ContextShift[IO]): IO[R] =
IO.fromFuture(IO(db.run(a))).guarantee(cs.shift)
/** Return an effect that runs a DB action with timing metrics collected */
def runIO[R](a: DBIOAction[R, NoStream, Nothing], timerName: String)(
implicit metric: MetricsF
def hello2Impl(c: blackbox.Context)(s: c.Expr[String]): c.Expr[Unit] = {
import c.universe._
c.Expr(q"""println("hello " + ${s.tree} + "!")""")
}