126 TILs and counting...

Preload critical assets

Today I learned that you can preload critical assets in a page by using the preload attribute on a link tag i.e. <link rel="preload">. Especially useful for things like fonts that are discovered later by the browser. Preload critical assets to improve loading speed

March 13, 2024 · 1 min · Brandon Pugh

Shell Check

Today I learned about ShellCheck which is essentially a linter for bash scripts. You can try it on the website but I recommend installing the vscode extension. I like that you can look up the rationale for each of the rules so it’s a great way to learn some best practices for bash scripts.

March 12, 2024 · 1 min · Brandon Pugh

Today I learned about a newer pseudo-class :focus-visible that lets you style an elements focused state like :focus but

February 29, 2024 · 1 min · Brandon Pugh

Windows Dev Drive

Today I learned about a new feature in Windows 11 called Dev Drive. It sounds like it essentially lets you create an optimized drive or volume for heavy file I/O that could speed up large solutions or test suites. Doesn’t look like I’m able to enable this on my work laptop yet but I’m curious to try it on one of my personal machines and see if it’s a noticeable improvement....

February 26, 2024 · 1 min · Brandon Pugh

Truncate table

Today I learned that there is a truncate table SQL command that deletes all data from a database table like Delete from but is faster and uses fewer system and transaction log resources. It’s supported in most database engines but there are likely caveats to keep in mind. For instance, with SQL Server: It will reseed identity columns You can’t truncate tables that referenced in constraints and it requires ALTER table privileges For clearing out data in lower environments though, I’ve found it useful....

February 20, 2024 · 1 min · Brandon Pugh

Logical Properties

I’ve recently been learning about the new logical properties in CSS. Essentially if we’re developing applications for a global audience, instead of thinking in terms of right/left or top/bottom, we should start thinking in terms of “inline” and “block”. These let us specify our styling and layouts in relative logical values instead of physical ones so they can adapt appropriately for right-to-left or vertical languages. For example, margin-left: 20px would now be margin-inline-start: 20px....

February 15, 2024 · 1 min · Brandon Pugh

Git Maintenance

Today I learned about the git maintenance command that runs tasks for regular maintenance of a git repo. If you run git maintenance start in a repo, git will create scheduled tasks to run at regular intervals to perform these tasks in the background like garbage collection. This will optimize and speed up the repo without having to tack them on occasionally as you run other commands. A particularly handy task it will run every hour is prefetch, where it does a git fetch but only pulls down the data and doesn’t update any refs....

February 12, 2024 · 1 min · Brandon Pugh

Number.isInteger()

Today I learned that the isNaN global function in javascript isn’t very useful for validating numbers. The main reason is that it returns false for an empty string since it coerces it to 0. To add to the confusion, Number.isNaN() behaves slightly differently since it just checks for the value NaN. For validation, I found Number.isInteger() to be the most useful.

February 8, 2024 · 1 min · Brandon Pugh

February 7, 2024 · 0 min · Brandon Pugh

font-variant-numeric

Today I learned about the font-variant-numeric CSS property that lets you control alternate glyphs for numbers. Not every font will support all of these but the tabular-nums option is common and seems especially useful for data in grids. Using Font Variant Numeric

February 1, 2024 · 1 min · Brandon Pugh