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 MiddlewareResult do | |
@type t :: {:pass, Plug.Conn.t()} | :reject | |
end | |
defmodule NextMiddleware do | |
@type t :: (Plug.Conn.t() -> MiddlewareResult.t()) | |
@spec return :: t() | |
def return, do: fn %Plug.Conn{} = conn -> {:pass, conn} end |
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
################################################# | |
# This file is a sample of some things you | |
# can do with this leader key setup. It's active | |
# right now! Set leader_key below and try it! The | |
# lua prioritizes home.toml, then work.toml, | |
# then falls back to this sample.toml. If you | |
# want different profile names, you can add it | |
# to the list in ~/.hammerspoon/init.lua. | |
################################################ |
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 { randomUUIDv7 } from "bun"; | |
import z from "zod"; | |
const mk_endpoint = <TReq, TRes, TPath extends string = string>(meta: { | |
path: TPath; | |
method?: string; | |
input_schema: z.ZodType<TReq>; | |
output_schema: z.ZodType<TRes>; | |
handler: (args: { | |
input: TReq; |
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 { randomUUIDv7 } from 'bun'; | |
import { Map, List, Set, set, } from 'immutable' | |
import z from 'zod'; | |
type HttpMethod = "GET" | "POST" | |
type Request = { body: string; url: string; method: HttpMethod; headers: Map<string, string> } | |
type Response = { body: string; url: string, method: HttpMethod; headers: Map<string, string> } |
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
{ | |
"description": "Capslock: short press toggles language, hold or with modifiers acts as command+control+option+shift", | |
"manipulators": [ | |
{ | |
"conditions": [ | |
{ | |
"input_sources": [{ "language": "en" }], | |
"type": "input_source_if" | |
} | |
], |
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
open System | |
open System.Data | |
open System.Text.Json | |
open Microsoft.FSharp.Core | |
type request = { path: string; body: string; headers: (string * string) list } | |
type response = { body: string; code: int; headers: (string * string) list } | |
type 'env context = { request: request; response: response; env: 'env } | |
type 'env handler = 'env context -> 'env context option |
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
namespace Application.Domain | |
open System | |
open Application.Domain | |
open Common | |
open System.Collections.Generic | |
open System.Threading.Tasks | |
open Application | |
open FSharp.UMX |
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
public record GetFirstNameState() : IChatState | |
{ | |
public ChatView View() => ChatView.Multiple( | |
ChatView.WithText("Enter first name"), | |
ChatView.WithTextHandler(OnText) | |
); | |
private async ValueTask<IChatState> OnText(TextMessage msg) | |
{ | |
return new GetLastName(msg.Text); |
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
#load @"paket-files/fsprojects/Chessie/src/Chessie/ErrorHandling.fs" | |
type Continuation<'output, 'next> = 'output -> 'next | |
module TerminalDsl = | |
open Chessie.ErrorHandling | |
type Terminal<'next> = | |
| WriteLine of string * Continuation<unit, 'next> | |
| ReadLine of unit * Continuation<string, 'next> |
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
open System.Collections.Generic | |
type xSet<'Id, 'T when 'Id : comparison and 'T : equality>(itemId, source: Map<'Id, 'T>) = | |
let mkNew source = xSet(itemId, source) | |
member val private HashCode = hash source | |
override this.GetHashCode() = this.HashCode | |
override this.Equals other = |
NewerOlder