view src/learn.html.luan @ 58:54933428f388

minor
author Franklin Schmidt <fschmidt@gmail.com>
date Sun, 14 Jan 2024 23:38:29 -0700
parents 536dc2d435ea
children 91b5033f53b1
line wrap: on
line source

local Luan = require "luan:Luan.luan"
local error = Luan.error
local pairs = Luan.pairs or error()
local Io = require "luan:Io.luan"
local Http = require "luan:http/Http.luan"
local Shared = require "site:/lib/Shared.luan"
local head = Shared.head or error()
local header = Shared.header or error()


local content = {
	intro = {
		title = [[Introduction]]
		content = function()
%>
<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>

<p>The next 3 lessons are basic computer literacy.  Even if you are not interested in programming, these would be useful skills.</p>

<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>

<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>

<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>

<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>

<p>If you have any questions, you can <a href="https://discord.gg/Qdcgvm3aAq">ask me on Discord</a>.</p>
<%
		end
	}
	editor = {
		title = [[Text Editor and JSON]]
		content = function()
%>
<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>

<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>

<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>

<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>
<%
		end
	}
	bash = {
		title = [[Bash - Command Line Shell]]
		content = function()
%>
<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>
<%
		end
	}
	hg = {
		title = [[Mercurial - Source Control]]
		content = function()
%>
<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 chapter 9.</p>

<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>

<code block>
~/learn $ hg version
Mercurial Distributed SCM (version 5.2.2)
(see https://mercurial-scm.org for more information)

Copyright (C) 2005-2019 Matt Mackall and others
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
~/learn $ 
</code>

<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:

<code block>
[ui]
username = Franklin Schmidt <fschmidt@gmail.com>

[auth]
hghosting.prefix = https://hg.reactionary.software/repo/
hghosting.username = fschmidt@gmail.com
hghosting.password = xxxxxxxxxx

[extensions]
hgext.extdiff =

[extdiff]
cmd.dm = diffmerge
</code>

<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>

<p>Now you can play with <a href="https://hg.reactionary.software/repo/test/">https://hg.reactionary.software/repo/test/</a> like this:</p>

<code block>
~/learn $ hg clone https://hg.reactionary.software/repo/test/ hgtest1
no changes found
updating to branch default
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
~/learn $ hg clone https://hg.reactionary.software/repo/test/ hgtest2
no changes found
updating to branch default
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
~/learn $ ls -Fd h*
hgtest1/	hgtest2/
~/learn $ cd hgtest1
~/learn/hgtest1 $ touch file.txt
~/learn/hgtest1 $ e file.txt 
~/learn/hgtest1 $ cat file.txt 
some text
~/learn/hgtest1 $ hg status
? file.txt
~/learn/hgtest1 $ hg add file.txt 
~/learn/hgtest1 $ hg status
A file.txt
~/learn/hgtest1 $ hg pull
pulling from https://hg.reactionary.software/repo/test/
no changes found
~/learn/hgtest1 $ hg commit -m 'add file.txt'
~/learn/hgtest1 $ hg push
pushing to https://hg.reactionary.software/repo/test/
searching for changes
remote: adding changesets
remote: adding manifests
remote: adding file changes
remote: added 1 changesets with 1 changes to 1 files
~/learn/hgtest1 $ cd ../hgtest2
~/learn/hgtest2 $ hg pull
pulling from https://hg.reactionary.software/repo/test/
requesting all changes
adding changesets
adding manifests
adding file changes
added 1 changesets with 1 changes to 1 files
new changesets aab34516d8dc
(run 'hg update' to get a working copy)
~/learn/hgtest2 $ hg update
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
~/learn/hgtest2 $ hg status
~/learn/hgtest2 $ cat file.txt 
some text
~/learn/hgtest2 $ e file.txt 
~/learn/hgtest2 $ cat file.txt 
some text
and more
~/learn/hgtest2 $ hg status
M file.txt
~/learn/hgtest2 $ hg pull
pulling from https://hg.reactionary.software/repo/test/
searching for changes
no changes found
~/learn/hgtest2 $ hg dm
~/learn/hgtest2 $ hg commit -m 'and more'
~/learn/hgtest2 $ hg push
pushing to https://hg.reactionary.software/repo/test/
searching for changes
remote: adding changesets
remote: adding manifests
remote: adding file changes
remote: added 1 changesets with 1 changes to 1 files
</code>

<%
		end
	}
	html = {
		title = [[HTML and CSS]]
		content = function()
%>
<p>later</p>
<%
		end
	}
	js = {
		title = [[JavaScript]]
		content = function()
%>
<p>later</p>
<%
		end
	}
	luan = {
		title = [[Luan]]
		content = function()
%>
<p>later</p>
<%
		end
	}
	http = {
		title = [[HTTP]]
		content = function()
%>
<p>later</p>
<%
		end
	}
	regex = {
		title = [[Regular Expressions]]
		content = function()
%>
<p>later</p>
<%
		end
	}
	java = {
		title = [[Java 8]]
		content = function()
%>
<p>later</p>
<%
		end
	}
	lucene = {
		title = [[Lucene]]
		content = function()
%>
<p>later</p>
<%
		end
	}
}


local function show_toc(content)
%>
			<ul>
<%
	for id, info in pairs(content) do
%>
				<li><a id="c_<%=id%>" href="#<%=id%>"><%=info.title%></a></li>
<%
	end
%>
			</ul>
<%
end

local function show_content(content,h)
	for id, info in pairs(content) do
%>
			<div heading>
				<h<%=h%>><a id="<%=id%>" href="#<%=id%>"><%=info.title%></a></h<%=h%>>
				<a href="#c_<%=id%>">contents</a>
			</div>
<%
		info.content()
	end
end

return function()
	Io.stdout = Http.response.text_writer()
%>
<!doctype html>
<html>
	<head>
<%		head() %>
		<title>Learn Reactionary Programming</title>
	</head>
	<body>
<%		header() %>
		<div content>
			<h1><a href="learn.html">Learn Reactionary Programming</a></h1>
			<hr>
			<h2>Contents</h2>
			<div toc>
<%			show_toc(content) %>
			</div>
			<hr>
<%			show_content(content,2) %>
		</div>
	</body>
</html>
<%
end