Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View ikitommi's full-sized avatar
💭

Tommi Reiman ikitommi

💭
View GitHub Profile
@ikitommi
ikitommi / 2024-01-02.md
Last active February 29, 2024 11:01
Clojurians Together 2024

Clojurists Together Project Update, 01-02/2024, Tommi Reiman

Worked on a big new release of Malli and wrote a blog post about it.

Reitit should be now feature-complete for OpenAPI, will cut out release soon.

Helped users to use and adopt the libs.

0.14.0 (2024-01-16)

@ikitommi
ikitommi / iframe.html
Created November 20, 2023 13:08
js-events learning trip
<html>
<body>
<h1>framed!</h1>
</body>
</html>
@ikitommi
ikitommi / 01-02.2023.md
Last active December 31, 2023 11:46
Clojurists Together Project Updates 2023

Clojurists Together Project Update, 01-02/2023, Tommi Reiman

Spend a lot of time with Malli and Reitit for revisiting, priorising and designing the essential missing core features.

For Malli, my top priority is to resolve the derivation and declaration of effective types, which will simplify library internals, writing schema extensions and makes CLJS bundle size smaller. Might have to break the protocol-api for this.

For Reitit, drafting a proper plugin system, have studied how this is solved in other ecosystems (e.g. fastify, phoenix). Reitit is powerful, proper plugin system makes it much more approachable.

Have also reviews lot's of PRs, helped people online and pushed out some smaller features and release the following:

@ikitommi
ikitommi / what.md
Last active December 1, 2022 18:32
Fetch + Clojure/Script

Given

  • local development, FE (3008) & BE (6047) running in separate ports
  • want to send and read cookies over fetch, BE sets, FE sends, http-only
  • in real environments, CORS is handled in api-gateway, so just need local CORS solution here

Solution

  1. fetch needs to have :credentials set to "include" (different ports, "same-origin" doesn't seem to work)
  2. because of 1, the local CORS can't have wildcards, you need list all possible headers, origins etc.
@ikitommi
ikitommi / malli-load-perf.md
Created January 23, 2022 10:38
Malli initialization speed

Create a new project:

~ mkdir demo
➜  ~ cd demo
➜  demo echo '{:deps {metosin/malli {:mvn/version "0.8.0-20220123.082237-3"}} :aliases {:dev {:extra-paths ["classes"]}}}' > deps.edn

Loading takes ages:

@ikitommi
ikitommi / demo1.clj
Last active January 9, 2022 08:47
Immutable Malli Schemas for Anna
;;
;; 1) using immutable support registry via options
;;
(ns demo
(:require [malli.core :as m]
[malli.registry :as mr]
[malli.util :as mu]))
(def default-registry
@ikitommi
ikitommi / malli.md
Last active March 2, 2022 12:00
Clojurists Together Malli Project Update, part1

Clojurists Together Project Update, Malli, part 1/3 (09-10/2021)

Have spent a lot of time working with Malli internals: on hammock, paper protos, reading about stuff done elsewhere, perf tuning and testing, better designs, in the mushroom forest, refactoring and finally, an initial new internal design I'm quite happy with.

The Performance gains

@ikitommi
ikitommi / user.clj
Created March 22, 2021 14:44
Malli + Edamame
(require '[malli.core :as m])
(require '[malli.transform :as mt])
(require '[edamame.core :as e])
(require '[clojure.walk :refer [prewalk]])
(defrecord Wrapped [])
(defn parse
"Parses an EDN String with edamame and returns a tuple2 of edn-value & path-vec->loc"
[s]
@ikitommi
ikitommi / schema.edn
Last active November 9, 2020 14:00
Demo of validating and coercing EDN data with edamame and malli
{:id "Lillan"
:tags #{:artesan :coffee ":hotel"}
:address {:street "Ahlmanintie 29"
:city "Tampere"
:zip "33100"
:lonlat [61.4858322, 23.7854658]}}
@ikitommi
ikitommi / user.clj
Last active September 5, 2020 15:56
Malli with lazy providers & lazy :multi
(require '[malli.core :as m])
(require '[malli.registry :as mr])
;; - cljs: :closure-defines {malli.registry/type "custom"}
;; - clj: :jvm-opts ["-Dmalli.registry/type=custom"]
(mr/set-default-registry!
(mr/lazy-registry
(mr/composite-registry
;; the defaults
(m/default-schemas)