Skip to content

Commit 68f1b5c

Browse files
committed
Fix links to the NOC book and add a prominent under-construction notice.
1 parent 75b77ee commit 68f1b5c

File tree

5 files changed

+67
-9
lines changed

5 files changed

+67
-9
lines changed

README.md

+7-3
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
22

33
[![License][license]][license-url]
44

5-
This is a ClojureScript implementation of the samples and exercises from [Nature of Code (2nd Edition)](noc2) by Daniel Shiffman
5+
This is a ClojureScript implementation of the samples and exercises from [Nature
6+
of Code (2nd Edition)][noc2] by Daniel Shiffman, implemented using [Quil][quil]
7+
and rendered with [Clerk][clerk].
68

7-
> ➡️View live at: https://ramblurr.github.io/nature-of-code/
9+
> ## ➡️ View live at: https://ramblurr.github.io/nature-of-code/
810
911
## Dependencies
1012

@@ -99,4 +101,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
99101

100102
[license]: https://img.shields.io/github/license/ramblurr/nature-of-code
101103
[license-url]: LICENSE
102-
[noc2]: https://github.com/nature-of-code/noc-book-2
104+
[noc2]: https://natureofcode.com/
105+
[quil]: http://quil.info/
106+
[clerk]: https://clerk.vision/

notebooks/index.md

+14-4
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
{:nextjournal.clerk/visibility {:code :hide}}
44
(:require
55
[noc.render]
6+
[noc.clerk-ext :as clerk-ext]
67
[nextjournal.clerk :as clerk]
78
[clojure.java.io :as io]))
89
```
@@ -11,11 +12,15 @@
1112

1213
This is my ClojureScript implementation of the samples and exercises from [Nature of Code (2nd Edition)][noc2] by Daniel Shiffman.
1314

14-
The book will be released in July 2024 but is available for pre-order now, [go check it out!][noc2]
15+
The book will be released in July 2024. It is available online for free, but the pre-order for the hardback and ebook editions are open now. [Go check it out!][noc2]
1516

16-
[noc2]: https://github.com/nature-of-code/noc-book-2
17+
[noc2]: https://natureofcode.com/
1718

18-
This project is a work in progress and isn't yet finished. I add to it when I find the time, which may not be often.
19+
```
20+
(clerk-ext/admonition " This project is a work in progress and isn't yet finished. I add to it when I find the time, which may not be often." :style :warning)
21+
```
22+
23+
You can find the source code for all of this at on GitHub at https://github.com/Ramblurr/nature-of-code
1924

2025

2126
### Why?
@@ -28,7 +33,12 @@ Implementing it in Clojure lets me train my functional muscles and it's rather f
2833

2934
Though I've tried to keep the code as close to the original as possible, Clojure is an immutable functional programming language, and my translation of the examples adhere to that property.
3035

31-
To learn how I've structured the code to avoid willy-nilly mutation or what tech I'm using to render all of this, check out the [background](notebooks/background).
36+
37+
```clojure
38+
(clerk/html
39+
[:p "To learn how I've structured the code to avoid willy-nilly mutation or what tech I'm using to render all of this, check out the "
40+
[:a {:href (clerk/doc-url "notebooks/background")} "background"] "."])
41+
```
3242

3343
## Table of Contents
3444

src/noc/clerk_ext.clj

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
(ns noc.clerk-ext
2+
(:require [nextjournal.clerk :as clerk]))
3+
4+
(def icons {:info [:svg
5+
{:xmlns "http://www.w3.org/2000/svg",
6+
:fill "none",
7+
:viewBox "0 0 24 24",
8+
:stroke-width "1.5",
9+
:stroke "currentColor",
10+
:class "size-8 flex-shrink-0 inline me-3"}
11+
[:path
12+
{:stroke-linecap "round",
13+
:stroke-linejoin "round",
14+
:d
15+
"m11.25 11.25.041-.02a.75.75 0 0 1 1.063.852l-.708 2.836a.75.75 0 0 0 1.063.853l.041-.021M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Zm-9-3.75h.008v.008H12V8.25Z"}]]
16+
:warning [:svg
17+
{:xmlns "http://www.w3.org/2000/svg",
18+
:fill "none",
19+
:viewBox "0 0 24 24",
20+
:stroke-width "1.5",
21+
:stroke "currentColor",
22+
:class "size-8 flex-shrink-0 inline me-3"}
23+
[:path
24+
{:stroke-linecap "round",
25+
:stroke-linejoin "round",
26+
:d
27+
"M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126ZM12 15.75h.007v.008H12v-.008Z"}]]})
28+
29+
(def color {:info "text-blue-800 bg-blue-50 dark:bg-gray-800 dark:text-blue-400"
30+
:warning "text-yellow-800 bg-yellow-50 dark:bg-gray-800 dark:text-yellow-300"})
31+
32+
(defn admonition [body & {:keys [style]
33+
:or {style :info}}]
34+
(clerk/html
35+
[:div
36+
{:class
37+
(str
38+
"flex items-center p-4 mb-4 text-sm rounded-lg "
39+
(get color style))
40+
:role "alert"}
41+
(get icons style)
42+
[:span {:class "sr-only"} "Info"]
43+
[:div
44+
body]]))

src/noc/ui.cljs renamed to src/noc/quil/ui.cljs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
(ns noc.ui
1+
(ns noc.quil.ui
22
(:require
33
[quil.sketch :as ap :include-macros true]))
44

src/noc/sketch.cljs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
(:require [quil.core :as q]
44
[quil.middleware :as m]
55
[quil.sketch :as ap :include-macros true]
6-
[noc.ui :as ui]
6+
[noc.quil.ui :as ui]
77
[noc.chapter-0-1 :as c0.1]
88
[noc.chapter-0-2 :as c0.2]
99
[noc.chapter-0-3 :as c0.3]

0 commit comments

Comments
 (0)