Skip to content

Instantly share code, notes, and snippets.

@HassanYA
HassanYA / middlewares.clj
Last active April 8, 2025 11:43
short-sse middleware for clojure datastar sdk httpkit
(require '[starfederation.datastar.clojure.adapter.http-kit :as hk-gen])
(defn short-sse
[handler]
(fn [request]
(let [hooks (handler request)
on-init (:init hooks)
on-open (:open hooks)
on-close (:close hooks)
init-results (when on-init (on-init))]
@HassanYA
HassanYA / query.clj
Last active August 14, 2024 02:12
Utils for constructing datomic queries
(ns utils.query
(:require [datomic.api :refer [q]]))
(defn- in?
[elm coll]
(some #(= elm %) coll))
(defn qr
"returns the first items of each tuple in `coll`"
[coll]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.