Posts Tagged “javascript”
The primary language of the web
-
Porting a Linux Program to Run in Browser using Emscripten
21 December 2023
On my infinitely long list of things I wanted to implement one of them was
taking a binary and stuffing it into a webpage to run entirely client side. Today I have accomplished just that with
my new Atari 2600 IDE. This allows you to write an assembly program
entirely in browser and run it without setting up any kind of toolchain on your
own machine. The following are my notes on getting emscripten, a way to
compile c/c++ to run in browser using llvm and wasm, to generate a binary and
interfacing that binary with some vanilla Javascript.
-
2D Metaballs Demo using Marching Squares
04 April 2022
Metaballs are organic looking blob like balls that merge and split
apart based on their distances from each other. They can be defined as a
single function or a summation of functions across the x and y plane. By
computing the contours, a very cool picture can be produced in real time
as shown below. However, computing the entirety of the function plane to
a high degree of precision is very expensive. To make it less expensive
and produce a good high quality contour marching squares can be
used. It samples 4 points of a function and interpolates where a
threshold value occurs to draw the outline. I was inspired by
Reducible’s video on how computers can draw weird shapes.
-
Exporting the AWS ReInvent Calendar to iCal
23 November 2021
I went to AWS Reinvent this year, and I wanted my registered events to
show up on my personal calendar. I’m honestly surprised they didn’t
implement an iCal export for your registered events. So I took these
steps to get them.
-
TIL my site is a JAMStack site.
10 September 2021
Today I learned that my site which has been basically the same since
2016 is a JAMStack site. Although it was coined in 2015 by
Netlify, it seems to have become really popular in the past 2 years as a
term. I’m told it’s more of a theoretical framework than anything else.
JAMStack stands for JavaScript, APIs, and Markup.
-
Converting a JavaScript array of strings to numbers, and the problem with `Array.map`
15 March 2021
JavaScript has a very weird type system with how strings can sometimes
be converted to numbers. It’s a very cool feature but can cause a lot of
pain because adding 1 doesn’t always do what you think it should due to
type-juggling. So you might think there’s an easy and relatively
foot-gun free to convert an array of strings to numbers. You would be
wrong, well maybe not at least if you don’t use the functional language
stuff in JavaScript or just do an in-place update or your array, but
that’s besides the point.
-
document.querySelectorAll
09 March 2018
document.querySelectorAll is one of the most handy tools in JavaScript
today. It’s a unified selector interface and brings so much power to the
end user. It’s applications are near endless, like replacing JQuery or
web scraping. It allows you to query the
current document using a css selector, and returns a NodeList.
It unifies the selection interface in the web today.
-
The Easiest Way to Add Spoilers to Your Blog
07 February 2018
This post describes what I think is the easiest way to add spoilers to your
blog. Spoilers are useful when you talk about fiction and don’t want to spoil
the ending for a user.