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
(defn oxford-comma [phrases] | |
(if (> (count phrases) 2) | |
(join ", and " [(join ", " (butlast phrases)) (last phrases)]) | |
(join " and " phrases))) | |
(oxford-comma []) ;; => "" | |
(oxford-comma ["one"]) ;; => "one" | |
(oxford-comma ["one" "two"]) ;; => "one and two" | |
(oxford-comma ["one" "two" "three"]) ;; => "one, two, and three" | |
(oxford-comma ["one" "two" "three" "four"]) ;; => "one, two, three, and four" |
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
(defn translate-string [s] s) | |
;; TODO ideas for i18n | |
;; Dispatch on content field vs. hard-coded transation keys in markup... | |
(def html [:html {:lang "en"} | |
[:head | |
[:title :text/hello]] | |
[:body | |
[:main | |
[:h1 :text/hello] | |
[:h2 :text/invalid] |
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
;; This file isn't strictly necessary, but it helps with running a REPL concisely | |
{:deps {nrepl/nrepl {:mvn/version "0.8.3"} | |
cider/cider-nrepl {:mvn/version "0.25.6"}} | |
:aliases | |
{:repl | |
{:main-opts ["-m" "nrepl.cmdline" "--middleware" | |
"[cider.nrepl/cider-middleware]"]}}} |
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
/** | |
* Dynamically reorder page elements using the flexbox order property. | |
*/ | |
function paginateZine({ pageSelector }) { | |
const pages = document.querySelectorAll(pageSelector) | |
const sheets = Math.ceil(pages.length / 4) | |
for (let s = 0; s < sheets; s++) { | |
const frontLeft = pages.length - 2 * s - 1 | |
const frontRight = 2 * s |
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
```sql | |
email varchar(100), | |
code varchar(64), | |
date_invited timestamp, | |
invited_by integer, | |
redeemed boolean, | |
UNIQUE (email, code), | |
``` |
OlderNewer