328 private links
Another well written guide for Zod.
Cache-Control can set multiple directives:
publicandprivatemax-agedefines the amount of time until which the client can consider the response "fresh"must-revalidateindicates the HTTP cache should not reuse stale responses when they aer disconnected from the origin serverno-storedisable the cache for the requestno-cachemeans ‘do not serve a copy from cache until you’ve revalidated it with the server and the server said you can use the cached copy’.no-cachewill always hit the network as it has to revalidate with the server before it can release the browser’s cached copy. It will always hit at least an HTTP header responsemust-revalidateneeds an associatedmax-agedirective at which time the browser will revalidate.immutableavoid revalidationstale-while-revalidateprovides is a grace period (defined by us in seconds) in which the browser is permitted to use an out of date (stale) asset while we’re checking for a newer version.stale-if-errorprovides a grace period if the server returns a 5xx error- I overlooked
s-maxage,proxy-revalidate,no-transform(useless for HTTPS) for proxies
Cache Busting strategies:
- no cache busting (dangerous) - style.css
- query string (does not work with proxies, i.e. Cloudflare) - style.css?v=1.2.14
- fingerprint - style.ae3f66.css
Fingerprinting is the best and allow the use of the immutable directive.
Not there is a new Clear-Site-Data: cache in case of need. Browser support is limited.
The post provide examples: Online Banking Page, Live Train Timetable Page, FAQs Page, Static JS (or CSS) App Bundle
These four ways are footguns, but they can be easily spotted in the codebase.
But over time, I think I discovered a better way: a script in my $PATH.
Benefits of scripts over aliases:
- No reloading; changes are picked up immediatly
- Choice of programming language
- Complex logic can be implemented
- More portable between shells
Aliases have certain benefits:
- special syntax (
cd..forcd ..with space) - completion
- conditional definition
- easier to bypass with
unalias - brevity: it's a one liner
- performance: alias are 100x faster.
getsong make sense and so many useful scripts.
- copy and pasta
- mkcd
- tempe
- trash
- mksh
- serveit starts a static file server
- getsong
- getpod to download something from a podcast player
- getsubs
- wifi off, wifi on and wifi toggle
url "my_url"parses a URL into its parts.- markdownquote to add
>before every line u+ 2025to get the unicode caracter associated- snippets to run some snippets
- some REPL launchers for Clojure, Deno, Php, Python and SQLite
- hoy prints the current date in ISO format
- timer
ocrto extract text from an imageremoveexifto delete EXIF data from imagesemojifuzzy finder helper https://codeberg.org/EvanHahn/dotfiles/src/commit/843b9ee13d949d346a4a73ccee2a99351aed285b/home/bin/bin/emoji
and more Process management scripts
The heap is a performance killer in Rust. One woraround is to swap to a more efficient memory allocator such as jemalloc.
In Cargo.toml:
[dependencies]
mimalloc = "0.1"
In main.rs:
#[global_allocator]
static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc;
The best performance optimisation is to avoid the heap. There is the heapless create for that. "The only thing to know is that the size of heapless types and collections needs to be known at compile-time."
Lifetime annotations are needed to tell the compiler that we are manipulating some kind of long-lived reference and let it assert that we are not going to screw ourselves
The only downside is that smart pointers, in Rust, are a little bit verbose (but still way less ugly than lifetime annotations). [They add some runtime overhead.]
When to use lifetimes annotations?
When performance really matters or when your code will be used in no_std environments.
I don't know. It seems to be overkill for the use. Instead of words, some functions get a capital letter.
It is currently experimental, but could be amazing because it parse a string of HTML safely and then insert it into the DOM
It uses GSAP
For MacOS only
-webkit-font-smoothing: antialiased;
A great CSS reset
A work to use rust build as PHP extension
It's not available in Firefox yet.
Note: "The key insight is that loading massive files into memory all at once is rarely a good idea, even when technically possible."
- Read the whole file and call it a day with
fs.readFile - Read by byte chunks with file handles and buffers
- (preferred) Use stream
The streams handle the bytes and UTF-8 encoding automatically. Each state can be defined with a callback: error, data, end.
Use appropriate buffer sizes for streams. Default is 64kB. The highWaterMark can adjust it though.
When to use streams: large files, real time data processing, memory is limited, composability, unknown file sizes.
When to use file handles: precise control.
When to use fs/promises: known small files. readFileSync() and writeFileSync() are acceptable for cli tools and scripts, but forbidden for web servers and concurrent apps.
Prefer Promise.all or Promise.allSettled to leverage concurrency.
Handle specific errors. Always. await handle.close() or stream.on('error', () => stream.destroy()). Another solution is await pipeline(source, transform, destinationl)
It marks the function as never returning.
In comparison, the unit type () returns at least a value.
The content is similar to The HTML Output Element from Matthias Ott or HTML’s Best Kept Secret: The .
They advocate for better usage of <output> instead of aria attributes. Let's use native instead of ARIA!
edit: I am deceived by all the quirks
Under accessibility, but this tag should be the norm
The author creates an extension for 3 uuid functions in Rust.
Tradeoffs: big extension size (330KB for simple uuids)
About using SQLite:
As mentioned in an earlier post the two biggest pain points are the "slow" schema changes on 10M+ rows tables locking the entire database for 10+ seconds, and the difficulty to implement automated failover. But it rocks for services that don't need 99.999 % of availability.