Skip to content

Commit 2039d22

Browse files
committed
🎄 Initial commit
0 parents  commit 2039d22

30 files changed

+174
-0
lines changed

.gitignore

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
.DS_Store
2+
.cache/
3+
.clerk/
4+
.cpcache/
5+
.lsp/
6+
node_modules
7+
notebooks/scratch*
8+
/public/js/
9+
/.shadow-cljs/
10+
/target/
11+
.idea/
12+
clerk.iml
13+
public/girouette.css
14+
public/images/
15+
yarn.lock
16+
*~
17+
.work
18+
/build
19+
/public/build
20+
.nrepl-port
21+
.clj-kondo/marick

README.md

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# 🎄 Advent of Clerk
2+
3+
A template repo for folks wanting to do [Advent of
4+
Code](https://adventofcode.com) with [Clerk](https://clerk.vision).
5+
6+
7+
## Usage
8+
9+
To play with this, you need to have [Clojure
10+
installed](https://clojure.org/guides/install_clojure), then run:
11+
12+
``` shell
13+
clj -M:nextjournal/clerk nextjournal.clerk/serve! --watch-paths src --port 7878 --browse
14+
```
15+
16+
This will start the Clerk webserver on port 7878 and watch the `src/`
17+
directory for changes and open Clerk in your browser.
18+
19+
Open one of the files there, e.g. `day_01.clj`, make a change and save
20+
it. You should then see these changes reflected in the browser.

deps.edn

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{:paths ["dev" "src" "resources"]
2+
:deps {org.clojure/clojure {:mvn/version "1.11.1"}
3+
io.github.nextjournal/clerk {:git/sha "9c51111dcfead67c52bf3d2cd0facaa415312614"}
4+
org.babashka/cli {:mvn/version "0.5.40"}}
5+
6+
:aliases {:nextjournal/clerk {:exec-fn nextjournal.clerk/build!
7+
:exec-args {:paths-fn advent-of-clerk.index/build-paths}}}}

dev/user.clj

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
(ns user
2+
(:require [advent-of-clerk.index :as index]
3+
[nextjournal.clerk :as clerk]
4+
[clojure.string :as str]
5+
[babashka.fs :as fs]))
6+
7+
8+
(comment
9+
(clerk/build! {:index "src/advent_of_clerk/index.clj"
10+
:paths (index/build-paths)
11+
:browse true}))
12+
13+

src/advent_of_clerk/day_00.clj

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
;; # 🎄 Advent of Clerk: Day 0
2+
(ns advent-of-clerk.day-0
3+
(:require [nextjournal.clerk :as clerk]))
4+
5+
;; This file is meant to be deleted when you start. It only exists to
6+
;; demo that files with contents are included in the build.

src/advent_of_clerk/day_01.clj

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
;; # 🎄 Advent of Clerk: Day 1
2+
(ns advent-of-clerk.day-1
3+
(:require [nextjournal.clerk :as clerk]))

src/advent_of_clerk/day_02.clj

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
;; # 🎄 Advent of Clerk: Day 2
2+
(ns advent-of-clerk.day-2
3+
(:require [nextjournal.clerk :as clerk]))

src/advent_of_clerk/day_03.clj

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
;; # 🎄 Advent of Clerk: Day 3
2+
(ns advent-of-clerk.day-3
3+
(:require [nextjournal.clerk :as clerk]))

src/advent_of_clerk/day_04.clj

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
;; # 🎄 Advent of Clerk: Day 4
2+
(ns advent-of-clerk.day-4
3+
(:require [nextjournal.clerk :as clerk]))

src/advent_of_clerk/day_05.clj

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
;; # 🎄 Advent of Clerk: Day 5
2+
(ns advent-of-clerk.day-5
3+
(:require [nextjournal.clerk :as clerk]))

src/advent_of_clerk/day_06.clj

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
;; # 🎄 Advent of Clerk: Day 6
2+
(ns advent-of-clerk.day-6
3+
(:require [nextjournal.clerk :as clerk]))

src/advent_of_clerk/day_07.clj

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
;; # 🎄 Advent of Clerk: Day 7
2+
(ns advent-of-clerk.day-7
3+
(:require [nextjournal.clerk :as clerk]))

src/advent_of_clerk/day_08.clj

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
;; # 🎄 Advent of Clerk: Day 8
2+
(ns advent-of-clerk.day-8
3+
(:require [nextjournal.clerk :as clerk]))

src/advent_of_clerk/day_09.clj

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
;; # 🎄 Advent of Clerk: Day 9
2+
(ns advent-of-clerk.day-9
3+
(:require [nextjournal.clerk :as clerk]))

src/advent_of_clerk/day_10.clj

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
;; # 🎄 Advent of Clerk: Day 10
2+
(ns advent-of-clerk.day-10
3+
(:require [nextjournal.clerk :as clerk]))

src/advent_of_clerk/day_11.clj

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
;; # 🎄 Advent of Clerk: Day 11
2+
(ns advent-of-clerk.day-11
3+
(:require [nextjournal.clerk :as clerk]))

src/advent_of_clerk/day_12.clj

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
;; # 🎄 Advent of Clerk: Day 12
2+
(ns advent-of-clerk.day-12
3+
(:require [nextjournal.clerk :as clerk]))

src/advent_of_clerk/day_13.clj

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
;; # 🎄 Advent of Clerk: Day 13
2+
(ns advent-of-clerk.day-13
3+
(:require [nextjournal.clerk :as clerk]))

src/advent_of_clerk/day_14.clj

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
;; # 🎄 Advent of Clerk: Day 14
2+
(ns advent-of-clerk.day-14
3+
(:require [nextjournal.clerk :as clerk]))

src/advent_of_clerk/day_15.clj

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
;; # 🎄 Advent of Clerk: Day 15
2+
(ns advent-of-clerk.day-15
3+
(:require [nextjournal.clerk :as clerk]))

src/advent_of_clerk/day_16.clj

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
;; # 🎄 Advent of Clerk: Day 16
2+
(ns advent-of-clerk.day-16
3+
(:require [nextjournal.clerk :as clerk]))

src/advent_of_clerk/day_17.clj

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
;; # 🎄 Advent of Clerk: Day 17
2+
(ns advent-of-clerk.day-17
3+
(:require [nextjournal.clerk :as clerk]))

src/advent_of_clerk/day_18.clj

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
;; # 🎄 Advent of Clerk: Day 18
2+
(ns advent-of-clerk.day-18
3+
(:require [nextjournal.clerk :as clerk]))

src/advent_of_clerk/day_19.clj

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
;; # 🎄 Advent of Clerk: Day 19
2+
(ns advent-of-clerk.day-19
3+
(:require [nextjournal.clerk :as clerk]))

src/advent_of_clerk/day_20.clj

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
;; # 🎄 Advent of Clerk: Day 20
2+
(ns advent-of-clerk.day-20
3+
(:require [nextjournal.clerk :as clerk]))

src/advent_of_clerk/day_21.clj

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
;; # 🎄 Advent of Clerk: Day 21
2+
(ns advent-of-clerk.day-21
3+
(:require [nextjournal.clerk :as clerk]))

src/advent_of_clerk/day_22.clj

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
;; # 🎄 Advent of Clerk: Day 22
2+
(ns advent-of-clerk.day-22
3+
(:require [nextjournal.clerk :as clerk]))

src/advent_of_clerk/day_23.clj

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
;; # 🎄 Advent of Clerk: Day 23
2+
(ns advent-of-clerk.day-23
3+
(:require [nextjournal.clerk :as clerk]))

src/advent_of_clerk/day_24.clj

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
;; # 🎄 Advent of Clerk: Day 24
2+
(ns advent-of-clerk.day-24
3+
(:require [nextjournal.clerk :as clerk]))

src/advent_of_clerk/index.clj

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
;; # 🎄 Advent of Clerk
2+
3+
;; [Advent of Code](https://adventofcode.com) with
4+
;; [Clerk](https://clerk.vision).
5+
(ns advent-of-clerk.index
6+
{:nextjournal.clerk/visibility {:code :hide :result :hide}}
7+
(:require [babashka.fs :as fs]
8+
[clojure.string :as str]
9+
[nextjournal.clerk :as clerk]))
10+
11+
#_(days-with-contents)
12+
13+
(defn build-paths
14+
"Computes the paths to build by looking for files in
15+
`src/advent_of_clerk` and filtering out unmodified templates (files
16+
with less than four lines)."
17+
[]
18+
(into []
19+
(keep (fn [day]
20+
(let [f (fs/file "src" "advent_of_clerk" (format "day_%s.clj" (cond->> day (<= day 10) (str "0"))))]
21+
(when (and (.exists f)
22+
(< 3 (count (str/split-lines (slurp f)))))
23+
(str f)))))
24+
(range 25)))
25+
26+
27+
#_(build-paths)
28+
29+
{:nextjournal.clerk/visibility {:result :show}}
30+
31+
^::clerk/no-cache
32+
(clerk/html (into [:ul] (mapv (fn [path]
33+
(when-let [day (second (re-matches #".*day_(\d+).clj" path))]
34+
[:li [:a {:href (clerk/doc-url path)} "Day " day]])) (build-paths))))
35+

0 commit comments

Comments
 (0)