Notes on enginering leadership and software development.
Daily Notes
Quick notes on things I learned that day. Mostly coding, and some a-ha moment in working with people, or tricks to get projects done on time.
Advent of Code 2023, in Swift! December 2nd:
There's a reason you stick with Python for Leetcode-style problems. And yet, I was itching to learn more Swift, so I'll do Advent of Code this year. In Swift!
Next.js is smart about what port to start on, and it's very cool! November 29th:
I won't take the prize on the biggest fan of Next.js competition, but I just noticed a thing!
If you start your Next app with
next dev
, but your default port 3000 is already taken, it'll just gracefully start on 3001, saving you a few minutes of stopping whatever was there. This is so cool! 👏🏼self.❨╯°□°❩╯︵┻━┻ November 24th:
I was working on a bringing Crons support for
sidekiq-scheduler
insentry-ruby
a couple days back, and found this gem of a method.Turns out, Sidekiq had the table flip method for a while, but the tech bro debauchery got replaced with zen and calmness.
November 19th:
Contentlayer supports markdown and even MDX formatting in the frontmatter fields of your documents, as long as you specify the field type as
mdx
ormarkdown
.The tricky part is that:
markdown
fields give you raw HTML code. You'd have to wrap it in__dangerouslySetHTML
or something.mdx
gives you the code that you have to pass intouseMDXComponent
to render.- Either way, you have to decide where to allow markdown formatting and where to strip it.
I've just implemented it for the blog here:
- Posts lists gets new
PostDescription
component that renders MDX-processed post description. - Post metadata and RSS gets raw description, implemented in a little custom field on Contentlayer that strips formatting.
July 18th:
TIL there are
beforeprint
andafterprint
events onwindow
in Javascript, so you can manipulate the DOM to make the print version look nicer beyond what you can do with print styles in CSS.Especially helpful to hide a 3rd-party iframe (in our case, Intercom widget) that otherwise caused the printed page to overflow horizontally.
July 17th:
Lattice supports keyboard shortcuts! Try
⌘+K
, it's magic. So cool to be able to jump to a person (and the 1:1 logs and agenda items) instead of looking for them in the sidebar. Thank you, Lattice FE team! 💛️July 7th:
If you use sign your git commits, and then rebase a pull request with your commits in GitHub GUI, it drops the signature from the rebased commits, and they'll have
unverified
badge on them.July 6th:
SymbolKit has a nice little command line utility that takes several
symbols.json
for multuple modules as inputs, and combines them into a chonkiersymbols.json
, so that later Swift DocC can resolve `` links in DocC comments between symbols in those separate module graphs.There are multiple things called tsx in js world. WAT. July 3rd:
Turns out, modern frontend people have two things called
tsx
. One is just for the Typescript + components file format. The other one is for this little library that makes Node play somewhat nice with ESM.I've long wanted to move the RSS generator into a script, tried a few times, and it always hurt. Of course it hurt this time, too.