This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@scala { | |
object Example { | |
@java { | |
public void main(String[] args) { | |
... | |
} | |
} | |
val json = @json { | |
one: 1, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import cats.effect.{Deferred, IO} | |
import java.util.concurrent.ConcurrentHashMap | |
trait WorkCache[Key, Result] { | |
private val map = new ConcurrentHashMap[Key, Deferred[IO, Result]] | |
protected def persisted(key: Key): IO[Option[Result]] | |
protected def work(key: Key): IO[Result] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import cats.effect.IO | |
import cats.effect.unsafe.implicits.global | |
import scala.concurrent.duration._ | |
object Maintenance { | |
def schedule(schedule: FiniteDuration, | |
initialDelay: Option[FiniteDuration] = None) | |
(action: IO[TaskResult]): MaintenanceTask = { | |
var normalSchedule = schedule |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package live.prepared | |
import cats.data.EitherT | |
import cats.effect._ | |
import cats.implicits._ | |
import fabric.parse.Json | |
import fabric.rw._ | |
import fs2.Chunk | |
import org.http4s._ | |
import org.http4s.dsl.Http4sDsl |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
import 'package:get/get.dart'; | |
class Screen { | |
final String key; | |
final Nav? nav; | |
final Widget Function() createWidget; | |
Screen({ | |
required this.key, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
import 'package:get/get.dart'; | |
void main() { | |
runApp(MyApp()); | |
} | |
class MyNavModel { | |
static final Map<String, MyNavModel> urls = {}; | |
final IconData icon; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Allows me to write MUnit tests like: | |
"Such and such" should { | |
"do something" in { | |
value should be(123) | |
} | |
} | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
inline def fromMapElems[A <: Product, T <: Tuple, L <: Tuple](map: Map[String, Value], index: Int, arr: Array[Any]): Unit = { | |
inline erasedValue[T] match | |
case _: (hd *: tl) => | |
inline erasedValue[L] match | |
case _: (hdLabel *: tlLabels) => | |
import fabric.rw.given | |
val hdLabelValue = constValue[hdLabel].asInstanceOf[String] | |
val hdValueOption = map.get(hdLabelValue) | |
val hdWritable = summonInline[Writer[hd]] | |
val valueOption = hdWritable.map(_.write(hdValue)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package hierarchical.rw | |
import hierarchical.* | |
import hierarchical.rw.* | |
import scala.deriving.* | |
import scala.compiletime.* | |
trait CompileRW { | |
implicit val stringR: Readable[String] = stringRW |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.concurrent.ConcurrentLinkedQueue | |
import scala.concurrent.duration.FiniteDuration | |
import scala.concurrent.{ExecutionContext, Future, TimeoutException} | |
import scala.util.{Failure, Success} | |
trait ParallelIterator[T] extends Iterator[T] { iterator => | |
private val buffer = new ConcurrentLinkedQueue[T] | |
private var finished = false | |
private var failure: Option[Throwable] = None |
NewerOlder