iljitsch.com

topics: program · BGP / IPv6 / more · settings · b&w · my business: inet⁶ consult · Twitter · Mastodon · LinkedIn · email · 🇺🇸 🇳🇱

Hi, I'm Iljitsch van Beijnum. These are my posts related programming and web development.

The one perfect sorting algorithm

A while ago, we discovered that there is no one perfect programming language. But is there one perfect sorting algorithm? I started thinking about that after seeing this Youtube video: The Sorting Algorithm Olympics - Who is the Fastest of them All. You may want to watch it first before continuing to read this post, as I'm going to give it away in the article.

Read the article - posted 2020-11-22

→ RecipeConverter

I recently got more interested in cooking, so I started looking for recipes on the internet. Then I found out that in the US, it's customary to list the amounts for many ingredients in teaspoons, tablespoons and cups, in addition to using pounds, pints, quarts and two types of ounces.

So I decided to make this page that will let me (and you) convert between these different measurements and the units the rest of the world understands: milliliters and grams. I wanted to make this easy so you could do it on the go on a phone or a tablet while cooking, hence the sliders rather than having to type in numbers.

This was the first time I used Javascript for a significant amount of functionality, and that was actually relatively easy.

Permalink - posted 2020-09-05

Even more BASIC: PC-BASIC on the Mac

After my BASICODE adventures a few days ago, I really wanted to see if I could run a BASICODE game on my VT420 terminal.

Full article / permalink - posted 2020-07-06

BASICODE: software distribution by radio broadcast in the 1980s

In 2009, I started an effort to digitize all my cassette tapes. As my last computer that still has a line in port is facing retirement, I decided to finally finish that project. Perhaps more about this later. Turns out some of these old cassettes have weird things on them, including radio broadcasts that contain computer programs.

Full article / permalink - posted 2020-07-04 - 🇳🇱 Nederlandse versie

The one perfect programming language

There's an episode of the TV show Friends where Chrissie Hynde has a guest role. Phoebe feels threatened by her guitar playing, and asks her "how many chords do you know?" "All of them."

Wouldn't it be cool if you could give the same answer when someone asks "how many programming languages do you know?"

But maybe that's a bit ambitious. So if you have to choose, which program language or programming languages do you learn?

Full article / permalink - posted 2020-04-01

Dark mode!

Last year Apple introduced dark mode in MacOS. This is really nice at night because your eyeballs aren't blasted with tons of white backgrounds in pretty much all windows. Unfortunately, most web pages still use a white background. Obviously you can redesign your website to conform to dark mode, but this looks rather stark on computers in light mode.

The solution would be to have your website render dark on a system in dark mode and light on a system in light mode. As of the new version of Safari included in MacOS 10.14.4 Mojave that was released just now, you can actually do that, as you can see here. Just switch your system between light and dark mode and you'll see this webpage switch over accordingly.

I like to use this terminal command to switch between light and dark mode:

sleep 2; osascript -e 'tell application "System Events" to tell appearance preferences to set dark mode to not dark mode'

(Change the last "not dark mode" to "true" or "false" to enable or disable dark mode. The line above toggles back and forth.)

On your website you need to set up conditional CSS with media queries. This is what I use:

<style type="text/css" media="screen, print">
  body { background-color: #f0f0f0; }
  A { color: #c00000; text-decoration: underline; }
  A:visited { color: #700000; text-decoration: underline; }
  H1 { font-family: futura, arial, sans-serif; font-size: 14pt; }
</style>
<style type="text/css" media="screen and (prefers-color-scheme: dark)">
  body { background-color: #202020; color: #d0d0d0; }
  A { color: #ff6734; }
  A:visited { color: #d82000; }
</style>

The first part between sets everything up for light mode, with a very light gray background.

Then the second style section (in bold) with (prefers-color-scheme: dark) overrides those earlier color settings. Note that all the font settings from the first style section are inherited by the second style section; no need to restate all of those.

That's it! Pretty cool, right?

Update: have a look here for more information, including how to use dark mode with javascript.

Permalink - posted 2019-03-26

older posts - newer posts

Search for:
RSS feed

Archives: 2013, 2019, 2020, 2021, 2022, 2023