A small alternative to the Garden CSS compiler that maps to modern CSS:
- It compiles to native nested rules.
[:a :b :c {…}]compiles toa b c {…}nota, b, c {…}.- Its grammar is flexible enough to allow arbitrary
@-rules.
A small alternative to the Garden CSS compiler that maps to modern CSS:
[:a :b :c {…}] compiles to a b c {…} not a, b, c {…}.@-rules.| (defmacro defn* [name & fdecl] | |
| (let [[docs impl] (split-with (some-fn symbol? string? map?) fdecl)] | |
| (letfn [(wrap [[bindings & body]] | |
| (let [[condition-map & body] (if (and (map? (first body)) | |
| (> (count body) 1)) | |
| body | |
| (cons nil body))] | |
| `(~bindings | |
| ~condition-map | |
| ;; TODO: do what you need here if you want to wrap the body |
| (ns shaun.lib.head-retention | |
| "Provides a `let-drain` macro for when we need to dangerously create a binding for a | |
| giant sequence. If we tag the consumption point with ^:draining, at | |
| compile-time it will catch any head retention caused by symbolic references. | |
| Non-problematic references can be manually tagged with ^:releasing to make the | |
| checker pass. It won't catch subtler cases that we likely won't see, but it | |
| will at least communicate that we are trying to avoid OOM in critical areas." | |
| (:require | |
| [clojure.walk :refer [macroexpand-all]] | |
| [schema.core :as s])) |
| (ns example.reagent-flash | |
| (:require | |
| [reagent.core :as r] | |
| [reagent.ratom :as ra] | |
| )) | |
| (defn- resolve-ratom [r* path] | |
| (cond | |
| (instance? Atom r*) [r* path] | |
| (instance? ra/RAtom r*) [r* path] |
| (ns example.touch-surface | |
| (:require | |
| [applied-science.js-interop :as j] | |
| [reagent.core :as r] | |
| [reagent.hooks :as hooks])) | |
| (defn with-nonpassive-event-listeners | |
| "TODO: remove this when React supports non-passive event listeners: | |
| https://github.com/facebook/react/issues/22794 |
Idea from Timur Xazamov https://x.com/nanot1m/status/1720494020651020562
While waiting for the [JS pipe operator] |>, maybe we can use ($=…, $=…, $) instead.
| #!/bin/bash | |
| # Cheatsheet for remembering Bash rules for Parameter Substitution: | |
| # https://tldp.org/LDP/abs/html/parameter-substitution.html#PSUB2 | |
| # Fallback for unset vars | |
| # Bash #——> like JavaScript | |
| ${a+b} #——> a && b |
| (ns user | |
| (:import (java.util.concurrent Executors TimeUnit))) | |
| (defn set-timeout [^Callable f ^long ms] | |
| (doto (Executors/newScheduledThreadPool 1) | |
| (.schedule f ms TimeUnit/MILLISECONDS))) | |
| (defn set-interval [^Callable f ^long ms] | |
| (doto (Executors/newScheduledThreadPool 1) | |
| (.scheduleAtFixedRate f 0 ms TimeUnit/MILLISECONDS))) |
| import java.nio.charset.StandardCharsets; | |
| import java.security.PrivateKey; | |
| import java.security.Security; | |
| import java.security.Signature; | |
| import java.util.Base64; | |
| import org.bouncycastle.jce.provider.BouncyCastleProvider; | |
| import org.bouncycastle.openssl.jcajce.JcaPEMKeyConverter; | |
| import org.bouncycastle.openssl.PEMKeyPair; | |
| import org.bouncycastle.openssl.PEMParser; |