Jun 14, 2022
Call me Kartik. I have a way of driving off the spleen and regulating the circulation. Whenever I find myself growing grim about the mouth; whenever it is a damp, drizzly November in my soul; whenever I become intolerable to my family--then, I account it high time to write some more tests as soon as I can.

20 new tests, 700 LoC, 33% LoC now devoted to tests.

Check out the changes.

Feeling much better 🙏 Now bracing to find out what I broke today.


Experiment: two ways of drawing polygons.

In the first, I have more control over the vertices and can make irregular polygons. The second is more expressive for making regular polygons, and just looks cooler.

Before:

Drawing a square by drawing one edge.

After:

Drawing a square with center and radius.

permalink

* *
Jun 9, 2022
This is a first: I ran a profiler to see where my app was feeling sluggish -- and the sluggishness disappeared! Magic profiler!

Turns out it was disabling LuaJIT. So I've now (temporarily? permanently?) disabled LuaJIT in lines.love

Maybe this kind of text processing isn't CPU intensive enough that a JIT can help? I have no idea which way is up anymore.

permalink

* *
Jun 8, 2022
An engaging couple of days of reading. Things I've been exchanging lots of little messages about with across different circles:

permalink

* *
Jun 6, 2022
This is the best content. I am here for this.

https://news.ycombinator.com/item?id=31637910#31641916

And no, it's not random or trolling.

"Follow for surreal gamedev. I'm making a Lovecraftian text editor called Tentacle Typer."

https://twitter.com/LeapJosh

permalink

* *
May 31, 2022
Gravity simulation for the kids

https://gist.github.com/akkartik/001dcd31aa0e042df0b0a0408f99d742

It's amazing how short the core of Newton's law of gravity is:

theta = angle(sun.x,sun.y, sat.x, sat.y)
dist = distance(sun.x,sun.y, sat.x,sat.y)
accelx = K*cos(theta)/dist/dist
accely = K*sin(theta)/dist/dist
velx = velx + dt*accelx
vely = vely + dt*accely
posx = posx + velx
posy = posy + vely
plot(posx,posy)

permalink

* *
May 4, 2022
I finally, *really* grok immediate-mode GUIs. Compare `draw_menu`.

Before

After

Now I don't need variables to record where the buttons are, and code for button events lives near code for drawing the button.

permalink

* *
May 3, 2022
Shower thought: we delay teaching kids geometry until we can trust them not to poke someone's eye out with the pointy end of a compass.

Here's a little program to do compass-and-straightedge geometrical construction on a computer.

Constructing a second line (in black) parallel to a given line (red) passing through a given point.

permalink

* *
Apr 23, 2022
First programming lesson for 4yo: how to make a U-turn when all you have is a left-turn. How to make a right-turn when all you have is a left-turn.

permalink

* *
Apr 15, 2022
Does anyone have experience implementing a Mastodon client? I've been reading links like https://www.w3.org/TR/activitypub and https://blog.joinmastodon.org/2018/06/how-to-implement-a-basic-activitypub-server, but I already have a server I'm perfectly happy with. How do I authenticate with it? Just by its custom authentication methods?

I guess I'm wondering if every Mastodon server also has some non-ActivityPub API.

permalink

* *
Apr 14, 2022
Building resilient systems

Systems are made of parts.

If you have too many parts, the odds of one of them failing go up.

If you have too few parts, any single part failing has a larger impact.

THEREFORE,

Arrange the parts in multiple phases over time. Like bulkheads, failures get isolated to a single phase.

Within a phase, use few parts to improve your odds.

Example: use git to generate your site, but host it on Netlify. Now you can build without Netlify and serve traffic without Github.

permalink

* *
archive
projects
writings
videos
subscribe
Mastodon
RSS (?)
twtxt (?)
Station (?)