React Updated +Created
Website: reactjs.org
React officially recommends that you use Next.js[ref], so just do it. It just sets up obvious missing functionality from raw React.
React feels like a good. But it also feels impossible to use/learn sometimes.
Its main design goal is to reduce DOM changes to improve rendering times.
And an important side effect of that is that it becomes easier to do stuff of the type:
  • user creates a new comment that appears on screen without page reload
  • comment has a delete button, which is JavaScript callback activated
and then the new comment easily gets the callback attached to it.
And it also ends up naturally doubling as a template engine.
But React can also be extremely hard to use. It can be very hard to know what you can and cannot do sometimes, then you have to stop and try to understand how react works things better:The biggest problem is that it is hard to automatically detect such errors, but perhaps this is the same for other frontend stuff. Though when doing server-side rendering, the setup should really tell you about such errors, so you don't just discover them in production later on.
Is is also very difficult to understand precisely why hooks run a certain number of times.
Examples under: react.
Video 1.
React for the Haters in 100 Seconds by Fireship (2022)
Source.
Scalable Vector Graphics Updated +Created
Companies have been really slow to support SVG features in their browsers, and that is very saddening: medium.com/@michaelmangial1/introduction-to-scalable-vector-graphics-6450c03e8d2e
You can't drop SVG support for canvas until there's a way to run untrusted JavaScript on the browser!
SVG does have some compatibility annoyances, notably SVG fonts. But we should as a society work to standardize and implement a fix those, the benefits of SVG are just too great!
Examples:
Schrödinger equation simulations Updated +Created
Video 1.
Simulation of the time-dependent Schrodinger equation (JavaScript Animation) by Coding Physics (2019)
Source.
Source code: github.com/CodingPhysics/Schroedinger. One dimensional potentials, non-interacting particles. The code is clean, graphics based on github.com/processing/p5.js, and all maths from scratch. Source organization and comments are typical of numerical code, the anonymous author is was likely a Fortran user in the past.
A potential change patch in sketch.js:
-   potential:     x => 2E+4*Math.pow((4*x - 1)*(4*x - 3),2),
+ potential:     x => 4*Math.pow(x - 0.5, 2),
Video 2.
Quantum Mechanics 5b - Schrödinger Equation II by ViaScience (2013)
Source. 2D non-interacting particle in a box, description says using Scilab and points to source. Has a double slit simulation.
Video 3.
Visualization of Quantum Physics (Quantum Mechanics) by udiprod (2017)
Source. Closed source, but a fantastic visualization and explanation of a 1D free wave packet, including how measurement snaps position to the measured range, position and momentum space and the uncertainty principle.
SQL example Updated +Created
We have some runnable SQL examples with assertion under the sequelize/raw directory.
These examples are written in the Sequelize library using raw queries.
Sequelize is used minimally, just to feed raw queries in transparently to any underlying database, and get minimally parsed results out for us, which we then assert with standard JavaScript. The queries themselves are all written by hand.
By default the examples run on SQLite. Just like the examples from sequelize example, you can set the database at runtime as:
  • ./index.js or ./index.js l: SQLite
  • ./index.js p: PostgreSQL. You must manually create a database called tmp and ensure that peer authentication works for it
Here we list only examples which we believe are standard SQL, and should therefore work across different SQL implementations:
Two.js Updated +Created
Examples at: two-js/.
JavaScript library, works both on browser and headless with Node.js to SVG.
Feels good. Maybe not ultra featured, and could have more simple examples in docs, but still good.
One of the main features of Two.js appears to be the fact that it can natively render to either SVG and canvas, rather than creating SVG through DOM hacks as done by other projects.
TypeScript Updated +Created
TypeScript is good. It does find errors in your JavaScript. But it is a form of "turd polishing". But Ciro Santilli would rather have a polished turd than a non-polished one.
Part of the reason TypeScript became popular is due to the universality of asset bundlers. Once you are already using an asset bundler, changing the .js extension into .ts to get a less shitty experience is an easy choice.
The other big reason is that JavaScript is so lose with type conversions, notably undefined happily converting to strings without problems, and any missing properties of Object happily being undefined. We should actually use ES6 Map everywhere instead of using Objects as maps.
Since TypeScript is not the default form of the language however, it inevitably happens that you need to add external types for a gazillion projects that are using raw JavaScript, and sometimes fight a lot to get things to work. And so we have: github.com/DefinitelyTyped/DefinitelyTyped. Not sure if this is beautiful, or frightening.
But in the end, as with other type of static linters, TypeScript generally transforms a few hard to debug runtime issues, into a bunch of stupid to solve compile time issues, which is generally a good thing.
The fact that this it parses comments JSDoc comments in JavaScript files is quite amazing.
Examples under typescript. Run each one of them with:
npx tsc example.ts
node example.js
Helper:
tsr() (
  # ts Run
  f="$1"
  npx tsc "$f"
  node "${f%.*}.js"
)
tsr example.ts
Some major annoyances of TypeScript:
Universal Module Definition Updated +Created
Since JavaScript devs are incapable of defining an unified import standard, this design pattern emerged where you just check every magic global one by one. Here's a demo where a Js library works on both the browser and from Node.js:
Wave equation solver Updated +Created
This section talks about solvers/simulators dedicated solving the wave equation. Of course, any serious solver will likely be able to solve a wider range of PDE, so this section contains mostly fun toys. For more serious stuff see: Section "PDE solver".
JavaScript toy solvers:
Web technology Updated +Created
Old cheat on separate repo: web.
Now moving to either:
  • separate files under: web-cheat/ for the boring stuff
  • subsections under this section for the more exciting stuff!
Why Ciro Santilli removed Disqus comments from his website in 2019-05-04 Updated +Created
As Ciro started getting a lot of comments on his home page about China, he decided that Disqus does not scale, and that it would be more productive long term to remove it and point people to GitHub issues instead.
Upsides of removal:
  • Disqus discoverability is bad:
    • there is no decent way to search existing issues, you have to do JavaScript infinite loading + Ctrl + F. So every reply that he wrote is a waste of time, as it will never be seen again.
    • comments don't have: decent URLs, titles, metadata like tags or open / close
  • Disqus archival is bad: web.archive.org/ does not work, and no one knows how to export the issues: www.archiveteam.org/index.php?title=Disqus
  • before, there were two places where people could comment, Disqus and GitHub issues. Now there is just one.
  • Disqus has ads if you ever reach enough traffic, which unacceptable, especially if the website owner don't get paid for them! It also makes page loads slower, although that likely does not matter much.
Downsides:
  • people are more likely to comment on Disqus than to create an issue on GitHub, especially because most people use GitHub professionally. But this has the upside that there will be less shitposts as well.
  • with Disqus you can see all issues attached to a page automatically, which is nice. But for as long as Ciro is alive, he intends to just solve the issues, cross link between content and issues and tag things appropriately.
Ciro's stance towards China hasn't changed, and China comments and corrections about his website are still welcome as always.