Skip to content

Instantly share code, notes, and snippets.

View AngelMunoz's full-sized avatar
🏠
Working from home

Angel D. Munoz AngelMunoz

🏠
Working from home
View GitHub Profile
@AngelMunoz
AngelMunoz / Htmx.kt
Created January 15, 2024 01:51
A few non exhaustive Htmx bindings and helpers for ktor and kotlin.html
package me.tunaxor.htmx
import io.ktor.server.application.*
import io.ktor.server.request.*
import io.ktor.server.response.*
import kotlinx.html.CommonAttributeGroupFacade
enum class HxSwap {
InnerHTML,
OuterHTML,
#r "nuget: TheBlunt"
open TheBlunt
module Common =
let RequiedMark =
pchar
(fun c -> c = '!')
(fun c -> $"$%c{c} is not a valid required mark.")
@AngelMunoz
AngelMunoz / UrlParser.fs
Last active October 26, 2023 21:28
Parse the segments + query + hash from a url with fparsec
namespace Routerish
type QueryValue =
| String of string option
| StringValues of string list
type RoutePart =
| Segment of segment: string
| ParamSegment of paramname: string
| Query of query: Map<string, QueryValue>
// differentiate the kind of payload you want to take
type AdditionPayload =
| Integers of int * int
| Strings of string * string
module Operations =
// handle your integers
let private addInts a b = a + b
// handle your strings
module Commands =
open FSharp.SystemCommandLine
open FSharp.SystemCommandLine.Aliases
type RunConfiguration with
static member FromString(value: string) =
module MyFunctions
let add a b = a + b
let printValue value = printfn "%s" value
@AngelMunoz
AngelMunoz / xml-to-json.fsx
Created September 22, 2022 03:46
A small F# plugin to work in a PoC
#i "nuget: C:/Users/scyth/repos/Perla/src/nupkg"
#i "nuget: https://api.nuget.org/v3/index.json"
#r "nuget: Newtonsoft.Json, 12.0.3"
#r "nuget: CalceTypes, 1.0.2"
open System.IO
open System.Xml
open Newtonsoft.Json
open type System.Text.Encoding
@AngelMunoz
AngelMunoz / meme-editor.imba
Last active September 11, 2022 04:59
A simple canvas based meme-like editor
const sizeOrMax\((size: number, max: number) => number) =
do(size,max) size > max ? max : size
export tag MemeEditor
css .row
d: flex; fld: column
css footer
d:flex; fld:column; m:auto
css canvas
module Navigo
open System
open Fable.Core
type DoneFn<'T> = 'T -> unit
type GenerateOptions =
abstract includeRoot: bool
@AngelMunoz
AngelMunoz / script.fsx
Last active April 15, 2022 14:35
a small script to explore reducible from F# (run with: dotnet fsi ./script.fsx)
#r "nuget: Reducible, 0.2.0"
open Morris.Reducible
type UserReducer =
| EmailDelta of string option
| AgeDelta of int option
| NameDelta of string option
type User =