This file contains 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
// summary : An API to rule them all - to define or customize new API at runtime | |
// keywords : scala, zio, tapir, http, zhttp, stateful, state, @testable, @exclusive | |
// publish : gist | |
// authors : David Crosson | |
// license : Apache NON-AI License Version 2.0 (https://raw.githubusercontent.com/non-ai-licenses/non-ai-licenses/main/NON-AI-APACHE2) | |
// id : dbccfc26-c532-4aa9-b3cd-eb13cbaa5370 | |
// created-on : 2023-12-08T18:45:32+01:00 | |
// managed-by : https://github.com/dacr/code-examples-manager | |
// run-with : scala-cli $file | |
// test-with : curl -L http://127.0.0.1:8080/hello/david |
This file contains 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
//> using scala 3 | |
//> using dep com.lihaoyi::fansi:0.4.0 | |
import scala.io.StdIn.readLine | |
import java.util.Arrays | |
case class Pos(val x: Int, val y: Int) | |
object Pos: | |
def fromUserInput(indexes:Seq[Int]): Option[Pos] = indexes match |
This file contains 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
//> using toolkit latest | |
//> using dep io.github.java-diff-utils:java-diff-utils:4.12 | |
//> using dep com.lihaoyi::fansi::0.4.0 | |
// use like this: scala-cli run . -- 200 lsof -p 28482 | |
import com.github.difflib.* | |
import com.github.difflib.patch.* | |
import fansi.* | |
import os.* |
This file contains 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
// | |
// loads remote file using fetch() streams and "pipe" it to webaudio API | |
// remote file must have CORS enabled if on another domain | |
// | |
// mostly from http://stackoverflow.com/questions/20475982/choppy-inaudible-playback-with-chunked-audio-through-web-audio-api | |
// | |
function play(url) { | |
var context = new (window.AudioContext || window.webkitAudioContext)(); |
This file contains 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
[info] Full optimizing /app-server/app-dashboard/target/scala-2.11/app-dashboard-opt.js | |
[debug] Linker: Compute reachability: 827080 us | |
java.lang.StackOverflowError | |
at org.scalajs.core.ir.Serializers$Deserializer.readTree(Serializers.scala:686) | |
at org.scalajs.core.ir.Serializers$Deserializer.readTreeFromTag(Serializers.scala:750) | |
at org.scalajs.core.ir.Serializers$Deserializer.readTree(Serializers.scala:687) | |
at org.scalajs.core.ir.Serializers$Deserializer.readTreeFromTag(Serializers.scala:752) | |
at org.scalajs.core.ir.Serializers$Deserializer.readTree(Serializers.scala:687) | |
at org.scalajs.core.ir.Serializers$Deserializer$$anonfun$readTrees$1.apply(Serializers.scala:928) | |
at org.scalajs.core.ir.Serializers$Deserializer$$anonfun$readTrees$1.apply(Serializers.scala:928) |
This file contains 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
java.lang.StackOverflowError | |
at scala.reflect.internal.Types$Type.isStable(Types.scala:271) | |
at scala.tools.nsc.typechecker.Typers$Typer.expectsStable$1(Typers.scala:507) | |
at scala.tools.nsc.typechecker.Typers$Typer.isStableContext(Typers.scala:514) | |
at scala.tools.nsc.typechecker.Typers$Typer.typedThis$1(Typers.scala:4702) | |
at scala.tools.nsc.typechecker.Typers$Typer.typedInAnyMode$1(Typers.scala:5374) | |
at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:5387) | |
at scala.tools.nsc.transform.Erasure$Eraser.typed1(Erasure.scala:712) | |
at scala.tools.nsc.typechecker.Typers$Typer.runTyper$1(Typers.scala:5423) | |
at scala.tools.nsc.typechecker.Typers$Typer.scala$tools$nsc$typechecker$Typers$Typer$$typedInternal(Typers.scala:5450) |
This file contains 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 rabbi | |
import magnolia._ | |
import ujson.{ObjVisitor, Visitor} | |
import upickle.{Api, AttributeTagged} | |
import scala.language.experimental.macros | |
import scala.reflect.ClassTag | |
trait UpickleSupportCommon { |
This file contains 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 example | |
/* Magnolia, version 0.7.1. Copyright 2018 Jon Pretty, Propensive Ltd. | |
* | |
* The primary distribution site is: http://co.ntextu.al/ | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file | |
* except in compliance with the License. You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 |
This file contains 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
trait DefaultModule extends mill.scalalib.ScalaModule { | |
//def scalaVersion = "2.12.4" | |
//def scalaJSVersion: T[String] = "0.6.22" | |
} | |
def main() = () |
This file contains 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
/** | |
* Copyright 2017 Scalway Krzysztof Pecyna | |
* | |
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), | |
* to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, | |
* and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | |
* | |
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | |
* | |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
NewerOlder