This file contains 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
(ns common.typography | |
"Improve quotes and make whitespace non-breaking after 1-2 letter words" | |
(:require [clojure.string :as str])) | |
(def typo-replace-starting-nbsp | |
[#"(^[a-zA-Z\u0400-\u0500]{1,2})\ ", "$1 "]) | |
(assert (= "A being in Australia <a class='yoy'>" | |
(apply str/replace "A being in Australia <a class='yoy'>" typo-replace-starting-nbsp))) |
This file contains 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
(ns clj-xslt | |
(:require [clojure.data.xml :as xml]) | |
(:import (java.time LocalDateTime) | |
(java.time.format DateTimeFormatter) | |
(java.io StringBufferInputStream StringWriter StringReader) | |
(javax.xml.transform.stream StreamSource) | |
(net.sf.saxon.s9api XsltCompiler Processor) | |
(net.sf.saxon Configuration))) | |
(def processor |
In React wrapper library UIx that I'm working on there's defui
macro that compiles Hiccup directly into React's VirtualDOM. Apart from doing that the macro also hooks into the compiler to hoist constant parts of VirtualDOM across components and namespaces, so that those parts will be essentially interned (cached).
Here's an example of two components defined in different namespaces where both of them share a part of the structure.
(ns foo.core
(:require [uix.core.alpha :refer [defui]]))
This file contains 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
#lang racket | |
;; this is a stand alone simple version of the closure conversion part of the hoist pass from the tarot compiler | |
;; see https://rain-1.github.io/scheme for more. | |
(require data/queue) | |
;; closure conversion for lambda calculus | |
;; | |
;; the input language is: |
This file contains 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
# evil cowsay cd | |
cd_() { if [ "$((1 + RANDOM % 10))" = 3 ]; then _out="I'm sorry $(whoami), I can't do that for you."; $(if [ $(which cowsay) ]; then echo cowsay; else echo echo; fi) "$_out"; else cd; fi } | |
alias cd='cd_' |