40
|
1 local Luan = require "luan:Luan.luan"
|
|
2 local error = Luan.error
|
|
3 local pairs = Luan.pairs or error()
|
|
4 local Io = require "luan:Io.luan"
|
|
5 local Http = require "luan:http/Http.luan"
|
|
6 local Shared = require "site:/lib/Shared.luan"
|
|
7 local head = Shared.head or error()
|
|
8 local header = Shared.header or error()
|
|
9
|
|
10
|
|
11 local content = {
|
|
12 intro = {
|
52
|
13 title = [[Introduction]]
|
40
|
14 content = function()
|
|
15 %>
|
|
16 <p>Learning reactionary programming will give you a deep understanding of programming and will enable to you to write your own programs and websites. However this is not enough to get a job with modern scum (members of depraved modern culture). Modern scum will expect you to use tools popular with them, so you would have to learn one of those. Probably the least horrible programming tool used by modern scum is <a href="python.html">Python</a>, so I would recommend learning that if you want a job.</p>
|
|
17
|
41
|
18 <p>The next 3 lessons are basic computer literacy. Even if you are not interested in programming, these would be useful skills.</p>
|
|
19
|
40
|
20 <p>I will develop this course incrementally based on demand. Whenever anyone completes the content here, I will add another lesson/section. This way I won't waste my time writing content that no one will use.</p>
|
|
21
|
|
22 <p>This course will be designed for you to learn reactionary programming in a logical sequence. I will focus on finding relevant resources, and I will only write explanations when nothing else is available on the subject. I will focus on web development since that is what I know best.</p>
|
|
23
|
41
|
24 <p>I will often say "Do X" without saying how to do X. A big part of programming is figuring out how to do things. Your two main resources are Google and ChatGPT. If you get stuck, you can ask me.</p>
|
40
|
25
|
|
26 <p>ChatGPT has become an essential programming tool. So the only task for this lesson is to play with ChatGPT. Later you can ask it technical questions.</p>
|
41
|
27
|
61
|
28 <p>If you have any questions, you can <a href="https://discord.gg/R6A3kaAJwj">ask me on Discord</a>.</p>
|
40
|
29 <%
|
|
30 end
|
|
31 }
|
|
32 editor = {
|
52
|
33 title = [[Text Editor and JSON]]
|
40
|
34 content = function()
|
|
35 %>
|
42
|
36 <p>A text editor is a basic tool for reactionary programmers. We use simple flexible tools. Modern scum use an <a href="https://en.wikipedia.org/wiki/Integrated_development_environment">IDE</a> which is big, <a href="http://www.mikraite.org/Changed-my-mind-about-IDE-s-tp2769.html">complicated</a>, and inflexible. We don't use such tools.</p>
|
|
37
|
|
38 <p>I reviewed the available text editors and I think <a href="https://www.sublimetext.com/">Sublime Text</a> is the best one available. So please download it and learn how it works.</p>
|
|
39
|
43
|
40 <p><a href="https://en.wikipedia.org/wiki/JSON">JSON</a> is the most popular text data format. I think JSON was the last good programming idea from modern culture, developed around 2001, before modern culture became fully depraved. Do your own research on JSON to understand it. It is fairly simple.</p>
|
42
|
41
|
44
|
42 <p>I paired Sublime Text with JSON because Sublime Text uses JSON files for its <a href="https://www.sublimetext.com/docs/settings.html">settings</a>. (Actually not quite pure JSON because it includes comments which are lines starting with <code>//</code>.) Experiment with Sublime Text settings to learn more about both Sublime Text and JSON.</p>
|
40
|
43 <%
|
|
44 end
|
|
45 }
|
41
|
46 bash = {
|
52
|
47 title = [[Bash - Command Line Shell]]
|
41
|
48 content = function()
|
|
49 %>
|
49
|
50 <p><a href="bash.html">Bash</a> is the other basic tool for reactionary programmers. I was hoping to just reference existing Bash tutorials in this lesson, but they are all horrible, so I am writing my own. So for this lesson, please read <a href="learn_bash.html">my tutorial</a>.</p>
|
41
|
51 <%
|
|
52 end
|
|
53 }
|
|
54 hg = {
|
52
|
55 title = [[Mercurial - Source Control]]
|
41
|
56 content = function()
|
|
57 %>
|
60
|
58 <p>Thankfully <a href="mercurial.html">Mercurial</a> is well documented. Read <a href="http://hgbook.red-bean.com/">Mercurial: The Definitive Guide</a> up to (and including) chapter 9.</p>
|
54
|
59
|
|
60 <p>To get started with Mercurial, download Mercurial from <a href="https://www.mercurial-scm.org/">their website</a> and install it. Then do:</p>
|
|
61
|
|
62 <code block>
|
|
63 ~/learn $ hg version
|
|
64 Mercurial Distributed SCM (version 5.2.2)
|
|
65 (see https://mercurial-scm.org for more information)
|
|
66
|
|
67 Copyright (C) 2005-2019 Matt Mackall and others
|
|
68 This is free software; see the source for copying conditions. There is NO
|
|
69 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
70 ~/learn $
|
|
71 </code>
|
|
72
|
58
|
73 <p>If this works, it is installed properly. Next <a href="http://hgbook.red-bean.com/read/a-tour-of-mercurial-the-basics.html#sec:tour-basic:username">set up your Mercurial configuration file</a> which is <code>~/.hgrc</code> on a Mac or <code>/c/Users/$(whoami)/mercurial.ini</code> on Windows <a href="https://www.msys2.org/">MSYS2</a>. My <a href="https://www.mercurial-scm.org/doc/hgrc.5.html">hgrc</a> file looks like this:
|
54
|
74
|
|
75 <code block>
|
|
76 [ui]
|
|
77 username = Franklin Schmidt <fschmidt@gmail.com>
|
|
78
|
|
79 [auth]
|
|
80 hghosting.prefix = https://hg.reactionary.software/repo/
|
|
81 hghosting.username = fschmidt@gmail.com
|
|
82 hghosting.password = xxxxxxxxxx
|
|
83
|
|
84 [extensions]
|
|
85 hgext.extdiff =
|
|
86
|
|
87 [extdiff]
|
|
88 cmd.dm = diffmerge
|
|
89 </code>
|
|
90
|
56
|
91 <p>You should register on <a href="https://hg.reactionary.software/">our Mercurial hosting service</a> and use your email as the username and the assigned password in <code>.hgrc</code>. The last two blocks set up <code>hg dm</code> to call <a href="https://sourcegear.com/diffmerge/">DiffMerge</a> by using the <a href="https://wiki.mercurial-scm.org/ExtdiffExtension">Extdiff extension</a>.</p>
|
54
|
92
|
|
93 <p>Now you can play with <a href="https://hg.reactionary.software/repo/test/">https://hg.reactionary.software/repo/test/</a> like this:</p>
|
|
94
|
|
95 <code block>
|
|
96 ~/learn $ hg clone https://hg.reactionary.software/repo/test/ hgtest1
|
|
97 no changes found
|
|
98 updating to branch default
|
|
99 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
|
100 ~/learn $ hg clone https://hg.reactionary.software/repo/test/ hgtest2
|
|
101 no changes found
|
|
102 updating to branch default
|
|
103 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
|
104 ~/learn $ ls -Fd h*
|
|
105 hgtest1/ hgtest2/
|
|
106 ~/learn $ cd hgtest1
|
|
107 ~/learn/hgtest1 $ touch file.txt
|
|
108 ~/learn/hgtest1 $ e file.txt
|
|
109 ~/learn/hgtest1 $ cat file.txt
|
|
110 some text
|
|
111 ~/learn/hgtest1 $ hg status
|
|
112 ? file.txt
|
|
113 ~/learn/hgtest1 $ hg add file.txt
|
|
114 ~/learn/hgtest1 $ hg status
|
|
115 A file.txt
|
|
116 ~/learn/hgtest1 $ hg pull
|
|
117 pulling from https://hg.reactionary.software/repo/test/
|
|
118 no changes found
|
|
119 ~/learn/hgtest1 $ hg commit -m 'add file.txt'
|
|
120 ~/learn/hgtest1 $ hg push
|
|
121 pushing to https://hg.reactionary.software/repo/test/
|
|
122 searching for changes
|
|
123 remote: adding changesets
|
|
124 remote: adding manifests
|
|
125 remote: adding file changes
|
|
126 remote: added 1 changesets with 1 changes to 1 files
|
|
127 ~/learn/hgtest1 $ cd ../hgtest2
|
|
128 ~/learn/hgtest2 $ hg pull
|
|
129 pulling from https://hg.reactionary.software/repo/test/
|
|
130 requesting all changes
|
|
131 adding changesets
|
|
132 adding manifests
|
|
133 adding file changes
|
|
134 added 1 changesets with 1 changes to 1 files
|
|
135 new changesets aab34516d8dc
|
|
136 (run 'hg update' to get a working copy)
|
|
137 ~/learn/hgtest2 $ hg update
|
|
138 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
|
139 ~/learn/hgtest2 $ hg status
|
|
140 ~/learn/hgtest2 $ cat file.txt
|
|
141 some text
|
|
142 ~/learn/hgtest2 $ e file.txt
|
|
143 ~/learn/hgtest2 $ cat file.txt
|
|
144 some text
|
|
145 and more
|
|
146 ~/learn/hgtest2 $ hg status
|
|
147 M file.txt
|
|
148 ~/learn/hgtest2 $ hg pull
|
|
149 pulling from https://hg.reactionary.software/repo/test/
|
|
150 searching for changes
|
|
151 no changes found
|
|
152 ~/learn/hgtest2 $ hg dm
|
|
153 ~/learn/hgtest2 $ hg commit -m 'and more'
|
|
154 ~/learn/hgtest2 $ hg push
|
|
155 pushing to https://hg.reactionary.software/repo/test/
|
|
156 searching for changes
|
|
157 remote: adding changesets
|
|
158 remote: adding manifests
|
|
159 remote: adding file changes
|
|
160 remote: added 1 changesets with 1 changes to 1 files
|
|
161 </code>
|
|
162
|
41
|
163 <%
|
|
164 end
|
|
165 }
|
|
166 html = {
|
52
|
167 title = [[HTML and CSS]]
|
41
|
168 content = function()
|
|
169 %>
|
59
|
170 <p>Google Chrome is the standard client-side web development tool. So the first step is to make sure that you have Chrome installed and running.</p>
|
|
171
|
|
172 <p>Using Chrome, on any page you can right-click in an empty area and from the menu select "View Page Source". This will show you the HTML for the webpage. If you try this on different websites, you will probably notice that my webpages are fairly short and well organized while the webpages of modern scum are unreadable. Another thing to try is to right-click anywhere in a page and select "Inspect". This should open the developer tools with the tab "Elements" selected. In this tab, you get the HTML organized as tree that can be expanded to collapsed. The "Elements" tab of Chrome developer tools will be your core tool when you work with HTML and CSS. You should play with it and do your own research on it to learn how it works.</p>
|
|
173
|
|
174 <p>The next step is to download this website like this:</p>
|
|
175
|
|
176 <code block>
|
|
177 ~/learn $ wget -r -k http://www.reactionary.software/
|
|
178 --2024-01-15 01:31:20-- http://www.reactionary.software/
|
|
179 ...
|
|
180 ~/learn $ cd www.reactionary.software/
|
|
181 ~/learn/www.reactionary.software $ ls -F
|
|
182 about.html hg_dev.html mercurial.html
|
|
183 bash.html index.html needed.html
|
|
184 books.html java.html nginx.html
|
|
185 discussion.html java_fork.html python.html
|
|
186 existing.html learn.html site.css
|
|
187 external_link.svg learn_bash.html this.html
|
|
188 freedit.html lucene.html wysiwyg.html
|
|
189 </code>
|
|
190
|
|
191 <p><code>index.html</code> is the home page. Find it in Mac Finder or Windows File Explorer, and then drag-and-drop it into Chrome. You should see this website. You can open the files in a text editor to see the HTML. And you can edit these files to see how the web page changes.</p>
|
|
192
|
|
193 <p>There is good documentation on HTML and CSS. Start with <a href="https://www.amazon.com/Cascading-Style-Sheets-Designing-Web/dp/0321193121/">Cascading Style Sheets: Designing for the Web</a>. This was written by the people who invented CSS and explains the core idea. Read the whole book. This book covers almost everything in this website. The only missing piece is <a href="https://css-tricks.com/snippets/css/a-guide-to-flexbox/">flexbox</a>. Next get <a href="https://www.amazon.com/CSS-Definitive-Guide-Layout-Presentation/dp/1098117611/">CSS: The Definitive Guide</a>. You should also read this whole book, but you can do it slowly as you work with CSS. You don't need to read this book right now, you can wait until you have finished the next two lessons.</p>
|
|
194
|
|
195 <p>Just play with HTML and CSS until you get a basic understanding of how they work. You should be able to understand the HTML and CSS of this website.</p>
|
|
196
|
|
197 <p>I left out resources for HTML itself. You should just look up HTML tags with Google or ChatGPT as you encounter them. That is good enough to learn HTML.</p>
|
|
198
|
|
199 <p>Ideally one should be able to look at web pages around the internet to learn. But unfortunately they are mostly overcomplicated crap that is very difficult to understand. You can try. My personal websites are like this one - very simple, so they don't look professional to modern scum. I can't link to my best commercial website because that would ruin its reputation (because I am infamous). But I can link to some of my old commercial websites <a href="http://test.tleggings.com/">here</a> and <a href="http://test.super-resume.com/">here</a>. These have reasonable HTML and CSS.</p>
|
|
200
|
|
201 <p>I have a few general principles for working with HTML and CSS. First, modern scum claim that HTML is for content and CSS is for styling. This is bullshit. Both HTML and CSS are for layout, don't think of them as being conceptually different. Just use both in the simplest possible way to get the results you want. Don't bother with the useless new HTML5 content tags like <code>header</code>. Just use <code>div</code> and <code>span</code> for most things. Also I use HTML attributes as selectors, not HTML classes. This is just simpler. HTML classes are useless, leave them for modern scum.</p>
|
|
202
|
|
203 <p>You will need HTML, CSS, Javascript, and Luan to make a website. So I suggest that you get a basic understanding of each of these and then go back later to study them in greater depth.</p>
|
41
|
204 <%
|
|
205 end
|
|
206 }
|
|
207 js = {
|
52
|
208 title = [[JavaScript]]
|
41
|
209 content = function()
|
|
210 %>
|
|
211 <p>later</p>
|
|
212 <%
|
|
213 end
|
|
214 }
|
|
215 luan = {
|
52
|
216 title = [[Luan]]
|
41
|
217 content = function()
|
|
218 %>
|
|
219 <p>later</p>
|
|
220 <%
|
|
221 end
|
|
222 }
|
|
223 http = {
|
52
|
224 title = [[HTTP]]
|
|
225 content = function()
|
|
226 %>
|
|
227 <p>later</p>
|
|
228 <%
|
|
229 end
|
|
230 }
|
|
231 regex = {
|
|
232 title = [[Regular Expressions]]
|
41
|
233 content = function()
|
|
234 %>
|
|
235 <p>later</p>
|
|
236 <%
|
|
237 end
|
|
238 }
|
|
239 java = {
|
52
|
240 title = [[Java 8]]
|
|
241 content = function()
|
|
242 %>
|
|
243 <p>later</p>
|
|
244 <%
|
|
245 end
|
|
246 }
|
|
247 lucene = {
|
|
248 title = [[Lucene]]
|
41
|
249 content = function()
|
|
250 %>
|
|
251 <p>later</p>
|
|
252 <%
|
|
253 end
|
|
254 }
|
40
|
255 }
|
|
256
|
|
257
|
|
258 local function show_toc(content)
|
|
259 %>
|
|
260 <ul>
|
|
261 <%
|
|
262 for id, info in pairs(content) do
|
|
263 %>
|
|
264 <li><a id="c_<%=id%>" href="#<%=id%>"><%=info.title%></a></li>
|
|
265 <%
|
|
266 end
|
|
267 %>
|
|
268 </ul>
|
|
269 <%
|
|
270 end
|
|
271
|
|
272 local function show_content(content,h)
|
|
273 for id, info in pairs(content) do
|
|
274 %>
|
|
275 <div heading>
|
|
276 <h<%=h%>><a id="<%=id%>" href="#<%=id%>"><%=info.title%></a></h<%=h%>>
|
|
277 <a href="#c_<%=id%>">contents</a>
|
|
278 </div>
|
|
279 <%
|
|
280 info.content()
|
|
281 end
|
|
282 end
|
|
283
|
|
284 return function()
|
|
285 Io.stdout = Http.response.text_writer()
|
|
286 %>
|
|
287 <!doctype html>
|
|
288 <html>
|
|
289 <head>
|
|
290 <% head() %>
|
|
291 <title>Learn Reactionary Programming</title>
|
|
292 </head>
|
|
293 <body>
|
|
294 <% header() %>
|
|
295 <div content>
|
|
296 <h1><a href="learn.html">Learn Reactionary Programming</a></h1>
|
|
297 <hr>
|
|
298 <h2>Contents</h2>
|
|
299 <div toc>
|
|
300 <% show_toc(content) %>
|
|
301 </div>
|
|
302 <hr>
|
|
303 <% show_content(content,2) %>
|
|
304 </div>
|
|
305 </body>
|
|
306 </html>
|
|
307 <%
|
|
308 end
|