222 private links
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:
system
is a namespace. - Value typing hints to the use cases of the variable. In the upper example:
color
. It could befontSize
for example - Descriptive names can use 2 patterns:
icyBlue
which is value-based oraccent
which 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.
It looks interesting! In JS, snapshot testing is a must because objects are everywhere.
It can be useful in Rust too.
It will solves a lot of tooltip or popover issues
A search input that expands itself on focus. It animates the width, but it uses CSS grid for the main layout.
How to launch a program without network access?
firejail --noprofile --net=none <program-name>