Welcome to my PinkLetter. A short, weekly, technology-agnostic, and pink newsletter where we cultivate timeless skills in web development.
Tiny code experiments are the best way to learn.
Here’s what I discovered building code2html in a couple of days:
code2html transforms a JavaScript code snippet into html with inlined styles. It features:
I tried with a textarea, but the text inside cannot be styled.
Then, I tried to overlay a textarea on top of a div styled with highlightjs, but it was a mess to coordinate.
So I stole as Picasso would.
I found out that http://carbon.now.sh and http://ray.so delegate it all to http://codemirror.net, so I did the same.
But what about inlining css styles?
I tried to use node.getComputedStyle() and inline all the css but:
So I did something else.
When you click on “Copy html”:
But how to switch themes?
All the inactive themes are wrapped in <style class="theme" media="not all">
The only active theme is wrapped in <style class="theme" media="all">
You still can’t believe all these hacks work? (No worries, I’m there with you.)
GENERALISTS VS SPECIALISTS: MUSIC EDITION by Jonathan Stark
You might be tempted to think that an orchestra conductor is a generalist and a lead violinist is a specialist.
Riccardo: I cannot stop but thinking that a full-stack engineer is a generalist and a product engineer is a specialist
Brag Doc: Why and How? by Janahan Sivaraman
You’re already doing awesome work, therefore, you should get recognized for it.
Riccardo: This is an excellent way to stop thinking about your input (I write ruby) and start thinking about your output (I increased traffic 2x).
HAVING, a less understood SQL clause
Understanding how the group by and having clauses work can help us write more efficient sql. I want to demonstrate this with an example based on a real situation.
Riccardo: Declarative code FTW (sometimes)