Skip to content

Instantly share code, notes, and snippets.

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
View gadthelp.scala
trait AA
trait AA1
trait BB
trait BB1
trait HasScenarios[A, B] {
def scenarios: Map[String, Scenario[A, B]]
}
View CatsCountDownLatch.scala
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]
}
View gist:3527793480b0117b2117e5863958a55b
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 Jan 14, 2019 — forked from Daenyth/SlickRunIO.scala
SlickRunIO.scala
View 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
View gist:0b723779d32da110e8e7
def hello2Impl(c: blackbox.Context)(s: c.Expr[String]): c.Expr[Unit] = {
import c.universe._
c.Expr(q"""println("hello " + ${s.tree} + "!")""")
}