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 com.raquo.laminar.api.L._ | |
import org.scalajs.dom | |
import scala.scalajs.js | |
/** @see [[https://www.websocket.org/echo.html]] */ | |
object WebSocketTester { | |
private val url = "wss://echo.websocket.org/" | |
private val transmit = Var("hello") |
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
// Perform HTTP requests lazily (onStart) as opposed to EventStream.fromFuture(dom.Ajax.*) | |
final class AjaxEventStream( | |
method: String, | |
url: String, | |
data: dom.ext.Ajax.InputData, | |
timeout: Int, | |
headers: Map[String, String], | |
withCredentials: Boolean, | |
responseType: String | |
) extends EventStream[dom.XMLHttpRequest] { |
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 zio | |
import java.io.{ InputStream, OutputStream } | |
import java.nio.charset.StandardCharsets | |
object streaming { | |
type Pull[-R, +E, +I] = ZIO[R, Option[E], I] | |
type Push[-R, +E, -I] = I => ZIO[R, E, Unit] | |
type Step[-R, +E, -I, +O] = I => ZIO[R, E, O] |
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
// Available variables: | |
// - Machine | |
// - interpret | |
// - assign | |
// - send | |
// - sendParent | |
// - spawn | |
// - raise | |
// - actions |
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 gdx; | |
import com.badlogic.gdx.ApplicationAdapter; | |
import com.badlogic.gdx.Gdx; | |
import com.badlogic.gdx.backends.lwjgl3.*; | |
import java.util.concurrent.Executors; | |
import java.util.concurrent.ScheduledExecutorService; | |
import java.util.concurrent.TimeUnit; |
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
final class FinalizerCancelable(finalizer: () => Unit) extends BooleanCancelable { | |
private val state = new AtomicReference(FinalizerCancelable.State()) | |
def isCanceled: Boolean = state.get().canceled | |
def acquire(): BooleanCancelable = { | |
state.get() match { | |
case FinalizerCancelable.State(true, _) => BooleanCancelable.alreadyCanceled | |
case s => state.compareAndSet(s, s.copy(active = s.active + 1)) match { | |
case false => acquire() |
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 scodec.codecs | |
import scala.language.higherKinds | |
import scodec._ | |
import scodec.bits.BitVector | |
object DelimitedCodec { | |
/** |
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 scodec.codecs | |
import scodec._ | |
import scodec.bits.{ByteVector, BitVector} | |
/** | |
* ChecksumCodec | |
*/ | |
object ChecksumCodec { |