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
| def foldZIO[A, E] = new PartialFoldZIO[A, E](()) | |
| final class PartialFoldZIO[A, E](val unit: Unit) extends AnyVal { | |
| def apply[R, E1, A0, B]( | |
| onError: E => ZIO[R, E1, B], | |
| onDefect: Throwable => ZIO[R, E1, B], | |
| onSuccess: A => ZIO[R, E1, B], | |
| ): Middleware[R, E1, A0, A, A, B] = new Middleware[R, E1, A0, A, A, B] { | |
| override def apply[R1 <: R, E2 >: E1](http: Http[R1, E2, A0, A]): Http[R1, E2, A0, B] = { | |
| http.foldHttp( |
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
| def accessLogger[R, E]( | |
| next: Http[R, E, Request, HttpResponse[R, E]] | |
| ): HttpApp[R with clock.Clock with Logging, E] = { | |
| Http.flatten { | |
| Http.fromEffectFunction[Request] { req => | |
| val path = req.url.path | |
| val method = req.method | |
| clock.instant.flatMap(start => { | |
| val logSuccess = (resp: HttpResponse[R, E]) => { |
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 gql.remoteschema | |
| import zio._ | |
| import zio.query._ | |
| import caliban._ | |
| import caliban.schema._ | |
| import caliban.introspection.adt._ | |
| import caliban.execution.Field | |
| import gql.remoteschema.json._ |
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_grpc.examples.helloworld | |
| import io.grpc.Status | |
| import scalapb.zio_grpc.ServerMain | |
| import scalapb.zio_grpc.ServiceList | |
| import scalapb.zio_grpc.{RequestContext, ZTransform} | |
| import zio._ | |
| import zio.console._ | |
| import zio.stream._ |
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 example | |
| import zio._ | |
| import zio.console | |
| import zio.random._ | |
| import zio.duration._ | |
| import zio.clock | |
| import scala.concurrent.Future | |
| // What _is_ ZIO? |
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
| function useAsync() { | |
| const [fn, setFn] = useState(null); | |
| const [state, setState] = useState({ | |
| loading: false, | |
| data: null, | |
| error: null | |
| }); | |
| const lastCallId = useRef(0); | |
| useEffect(() => { |
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
| defmodule Producer do | |
| require Logger | |
| use GenStage | |
| def start_link([]) do | |
| Logger.info("starting producer") | |
| GenStage.start_link(__MODULE__, :ok, name: __MODULE__) | |
| end | |
| def init(:ok) do |
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
| # vi-like navigation setw -g mode-keys vi | |
| # mouse control for panes | |
| set -g mouse on | |
| # don't rename windows automagically | |
| set-option -g allow-rename off | |
| # start windows numbering at 1 and rename on window close | |
| setw -g pane-base-index 1 | |
| set -g base-index 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
| type timerID; | |
| [@bs.val] external setInterval: (unit => unit, int) => timerID = "setInterval"; | |
| [@bs.val] external clearInterval: timerID => unit = "clearInterval"; | |
| module Counter = { | |
| let component = ReasonReact.component("Counter"); | |
| let make = (~initial = 0, _children) => { | |
| ...component, | |
| render: _self => { | |
| let (count, setCount) = ReactHooks.useState(initial); |
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
| defmodule Forma do | |
| # defmacro __using__([]) do | |
| # quote do | |
| # import Forma, only: [forma: 2] | |
| # end | |
| # end | |
| # defmacro forma(name, module) do | |
| # module = Macro.expand(module, __CALLER__) | |
| # transform = Forma.compile_module(module) |
NewerOlder