Tuesday, April 25, 2023

Memoization function

I found an interesting function while working on my latest project. I call it a memoization function.

The function stores the results in memory and returns immediately if called repeatedly with the same arguments. Such a function is suitable for some longer and demanding calculations.

That is nothing new, but it's a nice piece of code. ;)

Look at this:

Tuesday, April 18, 2023

Dynamically loading font resources

Did you know, that fonts can be downloaded with Javascript using a new API, the CSS Font Loading API?

The API exposes 2 objects - FontFace and FontFaceSet. A FontFace represents a font. After loaded it, the font can be added to the list of available fonts (called FontFaceSet), and then can be used normally.

See example: