Weeknotes 57
31st July, 2022
“Crimping automatically”
-
Use
git switch --orphan <new branch>
to create a new empty branch which shares no history with the parent branch. -
If you’re using ViewComponents you might find Lookbook useful.
Lookbook gives ViewComponent-based projects a ready-to-go development UI for navigating, inspecting and interacting with component previews.
-
I needed to re-locate my wifi access point after moving some furniture around. I’ve wanted to ceiling mount it for a while so this was a good opportunity. But how to run a cable? Luckily it’s PoE so I only needed to run a network cable via the loft, but pretty soon I was chasing out the wall to install a network socket too!
All of this means that I’m now the proud owner of a second RJ-45 crimping tool (I already have one, but this one does pass-through RJ-45 plugs, which are far easier to deal with).
-
I recently discovered Nineteen Hundred And Eighty Five by Wings. What a tune!
-
TJ DeVries published a great video on how to Run Code Automatically in Neovim. I found the content itself really useful, but the thing that really stood out to me was how great the Lua APIs are.
-
Append to the bottom of a buffer using
nvim_buf_set_lines
:vim.api.nvim_buf_set_lines(bufnr, -1, -1, false, { "foo", "bar" })
Will write…
foo bar
…to the bottom of the buffer.
-
The posts on this website are written in Markdown, using reference-style links which means I can wrap the link text in square brackets and then list the URLs at the bottom of the page. I really like this as it stops the main text getting cluttered up with URLs.
Unfortunately, I left a broken link in last week’s entry and only noticed days later. This led me to have a think of how I can prevent this in the future – I came up with two approaches.
1) I wrote some JavaScript to highlight links without a URL in bright yellow. The JavaScript is only executed during development.
{{ if .Site.IsServer }} <script> function highlightMissingLinks() { const article = document.querySelector("article"); const text = article.innerHTML; article.innerHTML = text.replace(/\[(.*?)\]/g, "<span style='background: yellow;'>[$1]</span>"); }; window.addEventListener("load", highlightMissingLinks); </script> {{ end }}
2) I setup a GitHub Action that runs
markdownlint
against changed Markdown files.markdownlint
will check a whole host of violations, one of which is broken links. I’m leaving all rules enabled for now and will see it they need tweaking over time.I started off using
super-linter
from GitHub, but it took over 2 minutes to run even though I only enabled Markdown linting, which I guess is fair enough given that it has ALL TEH LINTERS pre-installed.Then I changed to a slightly more home-grown solution using a
markdownlint
-only action in combination with thechanged-files
action.name: Lint on: pull_request: branches: [main] jobs: build: name: Markdown runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v2 with: fetch-depth: 0 - name: Get changed files id: changed-files uses: tj-actions/changed-files@v24 with: files: content/*.md - name: Lint Markdown if: steps.changed-files.outputs.any_changed == 'true' uses: nosborn/github-action-markdown-cli@v3.1.0 with: files: ${{ steps.changed-files.outputs.all_changed_files }}
This post will be the first to be checked, so I will see how it goes!
-
I’ve been working on the TIL (Today I Learned) site that I said I was making in Weeknotes 5 😄 Watch this space!
-
Recently it occurred to me that I’d never seen a 5G symbol on my iPhone even though my carrier added support earlier this year and I am often in 5G coverage areas.
Well, it turns out that you have to enable it in the iOS Settings under
Mobile Data -> Mobile Data Options -> Voice & Data -> 5G On
. The first test I did at fast.com, whilst travelling in a car, resulted in an average of 690Mbps 😮It really is quite astonishing.