@abreen/tada 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +290 -0
- package/bin/tada.js +361 -0
- package/config/authors.json +1 -0
- package/config/nav.json +28 -0
- package/content/index.md +19 -0
- package/content/lectures/01/Pair.java.md +296 -0
- package/content/lectures/01/Rectangle.java +80 -0
- package/content/lectures/01/demo.py +9 -0
- package/content/lectures/01/index.md +39 -0
- package/content/lectures/01/lecture1.pdf +0 -0
- package/content/lectures/index.md +25 -0
- package/content/markdown.md +379 -0
- package/content/problem_sets/index.md +6 -0
- package/fonts/google-sans-code/GoogleSansCodeVariable-Italic.ttf +0 -0
- package/fonts/google-sans-code/GoogleSansCodeVariable.ttf +0 -0
- package/fonts/google-sans-code/LICENSE.txt +93 -0
- package/fonts/inter/InterVariable-Italic.ttf +0 -0
- package/fonts/inter/InterVariable.ttf +0 -0
- package/fonts/inter/LICENSE.txt +92 -0
- package/package.json +70 -0
- package/public/avatars/alex.jpg +0 -0
- package/public/test.txt +1 -0
- package/src/_mixins.scss +4 -0
- package/src/anchor/README.md +6 -0
- package/src/anchor/index.ts +34 -0
- package/src/anchor/style.scss +48 -0
- package/src/code/README.md +5 -0
- package/src/code/index.ts +113 -0
- package/src/code/style.scss +101 -0
- package/src/code.scss +54 -0
- package/src/header/README.md +8 -0
- package/src/header/index.ts +43 -0
- package/src/header/style.scss +228 -0
- package/src/index.ts +73 -0
- package/src/layout.scss +144 -0
- package/src/literate/style.scss +60 -0
- package/src/print/README.md +4 -0
- package/src/print/index.ts +32 -0
- package/src/print/style.scss +82 -0
- package/src/question/README.md +3 -0
- package/src/question/index.ts +25 -0
- package/src/question/style.scss +116 -0
- package/src/search/README.md +6 -0
- package/src/search/index.ts +574 -0
- package/src/search/style.scss +217 -0
- package/src/style.scss +815 -0
- package/src/timezone/index.test.ts +100 -0
- package/src/timezone/index.ts +298 -0
- package/src/timezone/style.scss +16 -0
- package/src/timezone/timezones.json +58 -0
- package/src/toc/README.md +3 -0
- package/src/toc/index.ts +322 -0
- package/src/toc/style.scss +203 -0
- package/src/top/README.md +4 -0
- package/src/top/index.ts +75 -0
- package/src/util.ts +122 -0
- package/templates/_author.html +27 -0
- package/templates/_bottom.html +3 -0
- package/templates/_download.html +1 -0
- package/templates/_heading.html +19 -0
- package/templates/_nav.html +18 -0
- package/templates/_theme.scss +97 -0
- package/templates/_top.html +87 -0
- package/templates/authors.schema.json +13 -0
- package/templates/code.html +31 -0
- package/templates/default.html +13 -0
- package/templates/literate.html +16 -0
- package/templates/nav.schema.json +27 -0
- package/tsconfig.json +15 -0
- package/types/dev.ts +3 -0
- package/types/sass.d.ts +1 -0
- package/types/site-variables.d.ts +16 -0
- package/webpack/apply-base-path-plugin.js +78 -0
- package/webpack/build-state.js +97 -0
- package/webpack/code.test.js +162 -0
- package/webpack/colors.js +15 -0
- package/webpack/config.base.js +147 -0
- package/webpack/config.dev.js +23 -0
- package/webpack/config.prod.js +32 -0
- package/webpack/content-watch-plugin.js +153 -0
- package/webpack/deflist-id-plugin.js +62 -0
- package/webpack/external-links-plugin.js +37 -0
- package/webpack/features.js +5 -0
- package/webpack/flair.json +1 -0
- package/webpack/generate-content-assets-plugin.js +308 -0
- package/webpack/generate-favicon-plugin.js +198 -0
- package/webpack/generate-fonts-plugin.js +69 -0
- package/webpack/generate-manifest-plugin.js +116 -0
- package/webpack/globals.js +74 -0
- package/webpack/heading-subtitle-plugin.js +80 -0
- package/webpack/json-schema.js +19 -0
- package/webpack/log.js +143 -0
- package/webpack/markdown-plugins.test.js +203 -0
- package/webpack/pagefind-plugin.js +379 -0
- package/webpack/pagefind-plugin.test.js +131 -0
- package/webpack/pdf-text.js +163 -0
- package/webpack/print-flair-plugin.js +22 -0
- package/webpack/reachability.js +273 -0
- package/webpack/reachability.test.js +80 -0
- package/webpack/serve.js +104 -0
- package/webpack/site-variables.js +53 -0
- package/webpack/site.schema.json +67 -0
- package/webpack/templates.js +128 -0
- package/webpack/text-to-id.js +8 -0
- package/webpack/toc-plugin.js +167 -0
- package/webpack/util.js +49 -0
- package/webpack/utils/code.js +439 -0
- package/webpack/utils/content-files.js +147 -0
- package/webpack/utils/define-plugin.js +20 -0
- package/webpack/utils/file-types.js +26 -0
- package/webpack/utils/front-matter.js +57 -0
- package/webpack/utils/jdi-runner/LiterateRunner.class +0 -0
- package/webpack/utils/jdi-runner/LiterateRunner.java +241 -0
- package/webpack/utils/literate-java.js +153 -0
- package/webpack/utils/markdown.js +244 -0
- package/webpack/utils/parse-hsl.js +8 -0
- package/webpack/utils/paths.js +58 -0
- package/webpack/utils/render.js +466 -0
- package/webpack/utils/shiki-highlighter.js +26 -0
- package/webpack/validate-internal-links-plugin.js +155 -0
- package/webpack/watch-reachability-state.js +273 -0
- package/webpack/watch-reachability-state.test.js +198 -0
- package/webpack/watch-reload-client.js +54 -0
- package/webpack/watch.js +166 -0
package/content/index.md
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
title: Home
|
|
2
|
+
description: The home page for <%= site.title %>.
|
|
3
|
+
author: alex
|
|
4
|
+
|
|
5
|
+
## Welcome
|
|
6
|
+
|
|
7
|
+
This is an example site built with [Tada](https://github.com/abreen/tada).
|
|
8
|
+
|
|
9
|
+
## Getting started
|
|
10
|
+
|
|
11
|
+
Edit the files in `content/` to add your own pages. The `config/` directory
|
|
12
|
+
contains the site configuration, and `templates/` contains the HTML layouts.
|
|
13
|
+
|
|
14
|
+
See the [Markdown examples page](/markdown.html) for syntax examples.
|
|
15
|
+
|
|
16
|
+
!!! note
|
|
17
|
+
Consult the [readme](https://github.com/abreen/tada) for full
|
|
18
|
+
documentation on configuration, templates, and content authoring.
|
|
19
|
+
!!!
|
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
title: A generic `Pair` class
|
|
2
|
+
author: alex
|
|
3
|
+
|
|
4
|
+
<!---
|
|
5
|
+
You may hide code from the generated HTML page but still include it in the
|
|
6
|
+
final .java file by surrounding a code block with Tada's three-hyphen
|
|
7
|
+
HTML comment syntax.
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
import java.util.*;
|
|
11
|
+
```
|
|
12
|
+
-->
|
|
13
|
+
|
|
14
|
+
## Definition
|
|
15
|
+
|
|
16
|
+
A <dfn>pair</dfn> (*a*, *b*) is a sequence (an ordered collection) of two items.
|
|
17
|
+
In Java, we can use generic programming to implement a class `Pair` representing
|
|
18
|
+
a pair of items where *a* and *b* can be of any type.
|
|
19
|
+
|
|
20
|
+
If we further restrict the types of the items so that they must implement the
|
|
21
|
+
`Comparable` interface, we can then implement `Comparable` in the `Pair` class
|
|
22
|
+
by relying on the `compareTo()` methods of the items.
|
|
23
|
+
|
|
24
|
+
Let's start by defining the `Pair<S, T>` class, introducing two type parameters
|
|
25
|
+
`S` and `T`, where `S` must implement `Comparable<S>` and `T` must implement
|
|
26
|
+
`Comparable<T>`:
|
|
27
|
+
|
|
28
|
+
```
|
|
29
|
+
public class Pair<
|
|
30
|
+
S extends Comparable<S>,
|
|
31
|
+
T extends Comparable<T>
|
|
32
|
+
>
|
|
33
|
+
implements Comparable<Pair<S, T>>
|
|
34
|
+
{
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
!!! note
|
|
38
|
+
|
|
39
|
+
Java does not support syntax like `S implements Comparable<S>` in a generic type
|
|
40
|
+
parameter; you must use `extends`, even though `Comparable` is not a class.
|
|
41
|
+
|
|
42
|
+
!!!
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
### Immutability
|
|
46
|
+
|
|
47
|
+
Let's declare two fields for the first and second components of the pair:
|
|
48
|
+
|
|
49
|
+
```
|
|
50
|
+
public final S first;
|
|
51
|
+
public final T second;
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Instead of allowing clients to mutate a pair after creation, we've decided
|
|
55
|
+
to make both fields `final`. The ability for objects to change state can
|
|
56
|
+
sometimes lead to excess complexity, especially in long-running programs.
|
|
57
|
+
Immutability can also make debugging easier.
|
|
58
|
+
|
|
59
|
+
To create a pair, simply specify the first and second components. We will
|
|
60
|
+
not allow a component to be `null`.
|
|
61
|
+
|
|
62
|
+
```
|
|
63
|
+
public Pair(S first, T second) {
|
|
64
|
+
if (first == null || second == null) {
|
|
65
|
+
throw new IllegalArgumentException("components may not be null");
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
this.first = first;
|
|
69
|
+
this.second = second;
|
|
70
|
+
}
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
We'll also allow the creation of a new pair by replacing just one of the
|
|
74
|
+
components of an existing pair:
|
|
75
|
+
|
|
76
|
+
```
|
|
77
|
+
public Pair<S, T> first(S newFirst) {
|
|
78
|
+
return new Pair(newFirst, second);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
public Pair<S, T> second(T newSecond) {
|
|
82
|
+
return new Pair(first, newSecond);
|
|
83
|
+
}
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
With the `reversed()` method, we'll allow clients to flip the components
|
|
87
|
+
of an existing pair, passing no parameters:
|
|
88
|
+
|
|
89
|
+
```
|
|
90
|
+
public Pair<T, S> reversed() {
|
|
91
|
+
return new Pair<T, S>(second, first);
|
|
92
|
+
}
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
Then we'll have `toString()` return the standard representation of a pair as
|
|
96
|
+
(*a*, *b*).
|
|
97
|
+
|
|
98
|
+
```
|
|
99
|
+
@Override
|
|
100
|
+
public String toString() {
|
|
101
|
+
return String.format("(%s, %s)", first.toString(), second.toString());
|
|
102
|
+
}
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
To implement `Comparable` for the pair, we'll rely on the `compareTo()` method
|
|
106
|
+
of each item in the pair.
|
|
107
|
+
|
|
108
|
+
- If the first item in the first pair is greater than or less than the first
|
|
109
|
+
item in the second pair, we'll return that comparison result.
|
|
110
|
+
- However, if the first items of both pairs are equal, we return the result of
|
|
111
|
+
`compareTo()` on the second items of both pairs.
|
|
112
|
+
|
|
113
|
+
```
|
|
114
|
+
@Override
|
|
115
|
+
public int compareTo(Pair<S, T> other) {
|
|
116
|
+
int comp1 = first.compareTo(other.first);
|
|
117
|
+
if (comp1 == 0) {
|
|
118
|
+
return second.compareTo(other.second);
|
|
119
|
+
}
|
|
120
|
+
return comp1;
|
|
121
|
+
}
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
We use the `@Override` annotation to inform the Java compiler that we intend
|
|
125
|
+
to implement the `compareTo()` method. Since the signature of the method (its
|
|
126
|
+
name and parameter list) is unlikely to change, we could have simply omitted it.
|
|
127
|
+
|
|
128
|
+
Finally, we override `equals()` to delegate to `equals()` on the components.
|
|
129
|
+
Since in the constructor we don't allow `null` components, we don't need to
|
|
130
|
+
worry about `NullPointerException` here.
|
|
131
|
+
|
|
132
|
+
```
|
|
133
|
+
@Override
|
|
134
|
+
public boolean equals(Object other) {
|
|
135
|
+
if (!(other instanceof Pair)) {
|
|
136
|
+
return false;
|
|
137
|
+
}
|
|
138
|
+
var o = (Pair<?, ?>)other;
|
|
139
|
+
return first.equals(o.first) && second.equals(o.second);
|
|
140
|
+
}
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
Please note:
|
|
144
|
+
|
|
145
|
+
- The `equals()` method takes a parameter of type `Object` because `equals()`
|
|
146
|
+
is defined in the `Object` class; it's not an interface method and is not
|
|
147
|
+
generic.
|
|
148
|
+
- The `@Override` annotation informs the compiler we intend to override the
|
|
149
|
+
inherited version of `equals()` from the `Object` class.
|
|
150
|
+
- The question marks in the type `Pair<?, ?>` are known as
|
|
151
|
+
<dfn>wildcards</dfn> and are used to represent any type.
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
## Unit tests
|
|
155
|
+
|
|
156
|
+
To provide some confidence that our `Pair` class works, let's write some tests.
|
|
157
|
+
|
|
158
|
+
<!---
|
|
159
|
+
Code blocks inside of Tada's special containers, like alerts, collapisbles,
|
|
160
|
+
sections, etc. are included in the final .java file.
|
|
161
|
+
-->
|
|
162
|
+
|
|
163
|
+
<<< details The `test()` helper method
|
|
164
|
+
|
|
165
|
+
```
|
|
166
|
+
private static void test(boolean condition) {
|
|
167
|
+
// Get the line number from where this invocation of test() was made
|
|
168
|
+
StackTraceElement[] frames = Thread.currentThread().getStackTrace();
|
|
169
|
+
int lineNumber = frames[2].getLineNumber();
|
|
170
|
+
|
|
171
|
+
if (condition) {
|
|
172
|
+
System.out.printf("%d: passed%n", lineNumber);
|
|
173
|
+
} else {
|
|
174
|
+
System.out.printf("%d: FAILED%n", lineNumber);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
<<<
|
|
180
|
+
|
|
181
|
+
<!---
|
|
182
|
+
When Tada renders a literate code block, it trims leading whitespace common to
|
|
183
|
+
all lines in the block. For this reason, and because we don't need to explain
|
|
184
|
+
the main() method in this document, we hide the line of code introducing it
|
|
185
|
+
from the final HTML page.
|
|
186
|
+
|
|
187
|
+
```
|
|
188
|
+
public static void main(String[] args) {
|
|
189
|
+
```
|
|
190
|
+
-->
|
|
191
|
+
|
|
192
|
+
First, let's test that the constructor checks for `null` and throws the correct
|
|
193
|
+
exception:
|
|
194
|
+
|
|
195
|
+
```
|
|
196
|
+
try {
|
|
197
|
+
new Pair(null, 1);
|
|
198
|
+
test(false);
|
|
199
|
+
} catch (IllegalArgumentException e) {
|
|
200
|
+
test(true);
|
|
201
|
+
} catch (Exception e) {
|
|
202
|
+
// Any other type of exception would be incorrect
|
|
203
|
+
test(false);
|
|
204
|
+
}
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
Let's test the `equals()` and `compareTo()` implementations. We'll create
|
|
208
|
+
two objects representing (1, 1) and test if they are considered equal:
|
|
209
|
+
|
|
210
|
+
```
|
|
211
|
+
{
|
|
212
|
+
var a = new Pair(1, 1);
|
|
213
|
+
var b = new Pair(1, 1);
|
|
214
|
+
test(a.equals(b));
|
|
215
|
+
}
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
Let's make sure `equals()` correctly returns `false` when the components of
|
|
219
|
+
two pairs are _not_ the same:
|
|
220
|
+
|
|
221
|
+
```
|
|
222
|
+
{
|
|
223
|
+
var a = new Pair("foo", "bar");
|
|
224
|
+
var b = new Pair("zap", "pop");
|
|
225
|
+
test(!a.equals(b));
|
|
226
|
+
}
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
Then we'll test the inequalities relating (1, 1) and (2, 2):
|
|
230
|
+
|
|
231
|
+
```
|
|
232
|
+
{
|
|
233
|
+
var a = new Pair(1, 1);
|
|
234
|
+
var b = new Pair(2, 2);
|
|
235
|
+
test(a.compareTo(a) == 0);
|
|
236
|
+
test(a.compareTo(b) < 0);
|
|
237
|
+
test(b.compareTo(a) > 0);
|
|
238
|
+
}
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
Now we'll test that the second component is used for comparison when the first
|
|
242
|
+
component matches:
|
|
243
|
+
|
|
244
|
+
```
|
|
245
|
+
{
|
|
246
|
+
var a = new Pair(1, 7);
|
|
247
|
+
var b = new Pair(1, 3);
|
|
248
|
+
test(a.compareTo(b) > 0);
|
|
249
|
+
test(b.compareTo(a) < 0);
|
|
250
|
+
}
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
Now let's test `first()` and `second()`, which return a new pair with one
|
|
254
|
+
component replaced:
|
|
255
|
+
|
|
256
|
+
```
|
|
257
|
+
{
|
|
258
|
+
var apple = new Pair(1, "apple");
|
|
259
|
+
var orange = apple.second("orange");
|
|
260
|
+
|
|
261
|
+
test(orange.second.equals("orange"));
|
|
262
|
+
|
|
263
|
+
// Test that original pair wasn't modified
|
|
264
|
+
test(apple.second.equals("apple"));
|
|
265
|
+
|
|
266
|
+
var orange2 = orange.first(2);
|
|
267
|
+
test(orange2.first.equals(2));
|
|
268
|
+
|
|
269
|
+
// Test that original pairs weren't modified
|
|
270
|
+
test(orange.first.equals(1));
|
|
271
|
+
test(apple.first.equals(1));
|
|
272
|
+
}
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
Finally, let's test `reversed()`:
|
|
276
|
+
|
|
277
|
+
```
|
|
278
|
+
{
|
|
279
|
+
var d = new Pair("hello", 42);
|
|
280
|
+
var r = d.reversed();
|
|
281
|
+
test(r.first.equals(42));
|
|
282
|
+
test(r.second.equals("hello"));
|
|
283
|
+
}
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
<!---
|
|
287
|
+
As mentioned above, we hide the closing brackets for display purposes. They
|
|
288
|
+
are still required to produce valid Java code so they must be present in code
|
|
289
|
+
blocks.
|
|
290
|
+
|
|
291
|
+
```
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
```
|
|
295
|
+
-->
|
|
296
|
+
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/// A class representing a rectangle with integer side lengths.
|
|
2
|
+
///
|
|
3
|
+
/// Objects of this class may be mutated (changed after construction)
|
|
4
|
+
/// by scaling using a _scale factor_ (a floating-point number between 0 and 1).
|
|
5
|
+
public class Rectangle {
|
|
6
|
+
private int width;
|
|
7
|
+
private int height;
|
|
8
|
+
|
|
9
|
+
public Rectangle(int width, int height) {
|
|
10
|
+
setWidth(width);
|
|
11
|
+
setHeight(height);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/// These methods are `private` because we decided to allow mutations
|
|
15
|
+
/// only by scaling, not by directly setting the width or height to a new
|
|
16
|
+
/// value.
|
|
17
|
+
|
|
18
|
+
private void setWidth(int newWidth) {
|
|
19
|
+
if (newWidth <= 0) {
|
|
20
|
+
throw new IllegalArgumentException("width must be positive");
|
|
21
|
+
}
|
|
22
|
+
width = newWidth;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
private void setHeight(int newHeight) {
|
|
26
|
+
if (newHeight <= 0) {
|
|
27
|
+
throw new IllegalArgumentException("height must be positive");
|
|
28
|
+
}
|
|
29
|
+
height = newHeight;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
public int getWidth() {
|
|
33
|
+
return width;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
public int getHeight() {
|
|
37
|
+
return height;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/// An example of an accessor that does some computation with the fields'
|
|
41
|
+
/// values before returning something.
|
|
42
|
+
public int getArea() {
|
|
43
|
+
return getWidth() * getHeight();
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/// The scaling methods don't return a value since they change the
|
|
47
|
+
/// rectangle on which the methods are invoked. For example:
|
|
48
|
+
/// ```java
|
|
49
|
+
/// Rectangle r1 = new Rectangle(10, 2);
|
|
50
|
+
/// r1.scaleHorizontally(0.5f);
|
|
51
|
+
/// IO.println("new width: " + r1.getWidth());
|
|
52
|
+
/// ```
|
|
53
|
+
/// Outputs:
|
|
54
|
+
/// ```
|
|
55
|
+
/// new width: 5
|
|
56
|
+
/// ```
|
|
57
|
+
|
|
58
|
+
public void scaleHorizontally(float scaleFactor) {
|
|
59
|
+
checkScaleFactor(scaleFactor);
|
|
60
|
+
setWidth(Math.round(getWidth() * scaleFactor));
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
public void scaleVertically(float scaleFactor) {
|
|
64
|
+
checkScaleFactor(scaleFactor);
|
|
65
|
+
setHeight(Math.round(getHeight() * scaleFactor));
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/// Since both mutator methods must check for an invalid scale factor,
|
|
69
|
+
/// we implement the logic in a _helper method_.
|
|
70
|
+
/// * The method is `private` since clients do not need to call it.
|
|
71
|
+
/// * The method is `static` since it does not need access to any
|
|
72
|
+
/// instance fields; it only uses its parameter.
|
|
73
|
+
private static void checkScaleFactor(float scaleFactor) {
|
|
74
|
+
if (scaleFactor < 0 || scaleFactor > 1) {
|
|
75
|
+
throw new IllegalArgumentException(
|
|
76
|
+
"scale factor must be between zero and one"
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
parentLabel: Lectures
|
|
2
|
+
parent: /lectures/index.html
|
|
3
|
+
title: Lecture 1
|
|
4
|
+
description: An example lecture page.
|
|
5
|
+
author: alex
|
|
6
|
+
|
|
7
|
+
Here is a sample description of the topics covered at the first lecture.
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
## Slides
|
|
11
|
+
|
|
12
|
+
* [`lecture1.pdf`](./lecture1.pdf)
|
|
13
|
+
|
|
14
|
+
!!! note
|
|
15
|
+
When `feature.search` is `true` in the site config and MuPDF is installed
|
|
16
|
+
(when the `mutool` command is available), the search results can contain
|
|
17
|
+
references directly to specific PDF pages. Try searching "hello world" and
|
|
18
|
+
you should see a result for page 2 of `lecture1.pdf`.
|
|
19
|
+
!!!
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
## Code
|
|
23
|
+
|
|
24
|
+
* [`Rectangle.java`](./Rectangle.java) (an example of a code page)
|
|
25
|
+
* [`demo.py`](./demo.py) (another example of a code page)
|
|
26
|
+
* [`Pair.java`](./Pair.java) (an example literate Java page)
|
|
27
|
+
|
|
28
|
+
!!! note
|
|
29
|
+
Syntax highlighting is controlled by the `codeLanguages` configuration object
|
|
30
|
+
and is generated at build time by [Shiki](https://shiki.style).
|
|
31
|
+
!!!
|
|
32
|
+
|
|
33
|
+
## Review questions
|
|
34
|
+
|
|
35
|
+
??? question What is a computer?
|
|
36
|
+
|
|
37
|
+
A thing that computes.
|
|
38
|
+
|
|
39
|
+
???
|
|
Binary file
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
title: Lectures
|
|
2
|
+
author: alex
|
|
3
|
+
description: An example page for <%= site.title %>.
|
|
4
|
+
|
|
5
|
+
<%= timezoneChooser %>
|
|
6
|
+
|
|
7
|
+
One-hour lectures are held weekly at <time datetime="17:40">5:40 PM</time>.
|
|
8
|
+
Each lecture is recorded and made available by password-protected link.
|
|
9
|
+
Return to this page to access the recordings.
|
|
10
|
+
|
|
11
|
+
<<< details More details
|
|
12
|
+
Here is a sample collapsible with more information.
|
|
13
|
+
<<<
|
|
14
|
+
|
|
15
|
+
Following lecture, an optional office hour is held, during which you may ask
|
|
16
|
+
questions and get hints for the problem sets.
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
## Lecture notes
|
|
20
|
+
|
|
21
|
+
Click on each of the links below to access the lecture notes, source code files,
|
|
22
|
+
and other relevant information.
|
|
23
|
+
|
|
24
|
+
[Lecture 1](/lectures/01/index.html)
|
|
25
|
+
: Introduction, computation, models of a computer
|