388 private links
Recommended rust crates and resources can be found at the end of the guide
The headlines of the content picture well what content is in this post:
- The web used to be weirder
- Animated GIFs (WordArt)
- Music
- Cursor trails
- Webrings
- Guestbooks
and ho it differs from SCSS.
It explains the Writer monad and the Option monad.
This pattern is used for future or promise by the way.
aria-label and aria-labelledby are exclusive. So they can be enforced for components in typescript:
type ToggleSwitchProps = {
name: string;
checked: boolean;
handleToggle: () => void;
size?: "sm" | "lg" | "base";
classNames?: string;
} & ({ ariaLabel: string; ariaLabelledBy: never } | { ariaLabel: never; ariaLabelledBy: string });The author takes the example of a tree structure.
TL;DR; Start with lifetimes, if it is not enough and you don't need a specific guarantee: Box, then go for Rc or Arc if needed.
Various way to print "Hello World!" in rust
Advantages of types: they are here to help, improve readability, and provide context
A quick guide on makefiles
All that we did to get this speedup is implement the Serialize trait using one line for the body of the serialize method!
But implementing the trait directly loses the possibility to serialize the structure with the #derive(Serialize) macro.
Instead, you should implement it on wrapper types that act like formatters.
Also for efficiency: format_args! doesn't allocate or even apply the formatting! It only returns Arguments which is a formatter that borrows its arguments.
Ok not bad at all. I still think Rust is not meant for prototyping, but let's give it a try.
We can now calculate the remainder rem() and the modulo mod in css.
We will have to wait a bit though for browser support: https://caniuse.com/?search=rem() and https://caniuse.com/?search=mod()
- Consider mixing kebab-casing with camelCasing:
--system-color-controlAccent: blue; - Using namespaces can help to avoid collision. In the upper example:
systemis a namespace. - Value typing hints to the use cases of the variable. In the upper example:
color. It could befontSizefor example - Descriptive names can use 2 patterns:
icyBluewhich is value-based oraccentwhich is usage-based. - Dark mode is simpler with usage-based variables
When to use between value- and usage-base?
Variables with value-based names can be useful for restricting the number of values in your interface. Using numbers can be useful, but sometimes overkill.
Usage-based tend to be useful to describe scopes of capability and utility within the project. The utility of a usage-based name comes in how it guides a developer or designer in its use.
There are often 3 levels of abstractions:
- defining the values
- different property for custom controls such as
--color-accentColor - the CSS variable of use in the component such as
--button-color
Don't Use Fixed CSS height or width on Buttons, Links, or Any Other Text Containers | Ashlee M Boyer
Use padding, relative line-height and a flow layout instead.
The projects of UnJs are awesome
As I am using Typescript on a daily basis, it helped to have such a comparison 😃
A great way to use CSS properties is to make "private" properties for a class and then create variants based on other CSS class modifiers that sets these variables.