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
/** | |
* Single-file play framework application! Make sure everything | |
* works, as this is the test case that un-earthed #371 | |
*/ | |
import $ivy.`com.typesafe.play::play:2.5.14` | |
import $ivy.`com.typesafe.play::play-netty-server:2.5.14` | |
import $ivy.`org.scalaj::scalaj-http:2.2.1` | |
import play.core.server._, play.api.routing.sird._, play.api.mvc._ | |
import scalaj.http._ |
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
// | |
// 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 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
// 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 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
//> using scala 3.7 | |
//> using dep org.http4s::http4s-ember-server:0.23.30 | |
//> using dep org.http4s::http4s-dsl:0.23.30 | |
//> using dep org.http4s::http4s-scalatags::0.25.2 | |
//> using option -Wunused:all | |
import scalatags.Text.all.* | |
import cats.effect.* | |
import fs2.Stream | |
import org.http4s.* | |
import org.http4s.dsl.io.* |