222 private links
Source code: https://github.com/rust-adventure/lets-code-cli-config/blob/main/src/main.rs
Idea from the comments: Look into unwrap or default and implement the default trait, it cleans up the clutter from where you call unwrap_or
A small crate to check which directory
The library provides the location of these directories by leveraging the mechanisms defined by
- the XDG base directory and the XDG user directory specifications on Linux,
- the Known Folder system on Windows, and
- the Standard Directories on macOS.
From scratch
The author provides a list of hosting too: https://web.pixelshannon.com/make/#:~:text=where%20can%20i%20publish%20my%20website%20for%20free%3F
When I got started in computers, you had to do low-level bit twiddling to get anything very interesting done, so you pretty much couldn’t avoid learning about XOR. But these days, to a high-level programmer, it’s much more of an optional thing, and you can perfectly well not know much about it.
So I collected some thoughts together and gave a lecture on XOR. Slightly to my own surprise, I was able to spend a full hour talking about it – and then over the course of the next couple of weeks I remembered several other things I could usefully have mentioned.
All of it is available on this page.
Invalid Date in Cobol have a default value.
If the birthdate field contains corrupt or mismatched data, it defaults to 1875-05-20, which serves as a flag. May 20, 1875, is the day the international standards and metrics treaty was signed.
It causes some bugs, such as a 150 year old.... 2025-1975 = 150
Eventually, I got sick of manually converting my equations, so I wrote a Python script to automatically convert LaTeX expressions to MathML in my blog posts. I started considering writing an automated tool for inserting my navbars into the HTML files, and then I realized that I was completely wasting my time. After some shopping around, I decided Zola was the least deranged of the existing site generators, so I tried rolling with it.
I’m using a fork of Zola with Typst support written by cstef.
For thousands of years, man has invented technology to ameliorate the petty pains and discomforts of his life. It would be an insult not to use it.
So dynamic-linking saves us about 11%11% of build time in incremental case.
This time dynamic-linking saves us 0.25 seconds, or about merely 5%5%.
About the new Anki algorithm to schedule flashcard reviews. I didn't read it yet, but it can become handy.
The type=number state is not appropriate for input that happens to only consist of numbers but isn't strictly speaking a number. For example, it would be inappropriate for credit card numbers or US postal codes. A simple way of determining whether to use type=number is to consider whether it would make sense for the input control to have a spinbox interface (e.g. with "up" and "down" arrows). Getting a credit card number wrong by 1 in the last digit isn't a minor mistake, it's as wrong as getting every digit incorrect. So it would not make sense for the user to select a credit card number using "up" and "down" buttons. When a spinbox interface is not appropriate, type=text is probably the right choice (possibly with an inputmode or pattern attribute).
inputmode="decimal"
or inputmode="number"
fit better for these cases.
New HTML features of 2025
Awesome
The current nightly preview to run rust file as scripts.
alias cargo-script='cargo +nightly -Zscript -q'
is my new friend.
An accessibility decision tree for the alt
attribute
an interactive tutorial series on building realtime collaborative applications using the Yjs CRDT library.
How to prototype in Rust?
- use simple types: String, Vec
, Box , Rc and Arc<Mutex > to avoid ownership and lifetime issues. - make use of type inference
- use
.unwrap()
, and quick context withbail!()
undwith_context
of the crateanyhow
- run the code (and tests) automatically with
bacon
- have a look to
cargo-script
- Use
println!
anddbg!
for debugging:dbg!
has advantages such as printing file name and line number, outputs the expression adn less syntax-heavy.dbg!(x)
- Design through types
- rely on the
todo!
macro - rely on the
unreachable!
for assumptions of dead code branches: it documents assumptions - rely on
assert!
for invariants: it documents assumptions - avoid generics and lifetimes: use concrete types and owned types
- keep a flat hierarchy (of files), then only starts playing with mod around. All in the same file.
- start small