mirror of
https://github.com/jbranchaud/til
synced 2026-01-07 09:08:01 +00:00
Compare commits
6 Commits
d46aa6510e
...
036789e412
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
036789e412 | ||
|
|
497b0ff3b7 | ||
|
|
64df6d16d7 | ||
|
|
7dac057246 | ||
|
|
8961c67026 | ||
|
|
295fe153ad |
10
README.md
10
README.md
@@ -10,7 +10,7 @@ pairing with smart people at Hashrocket.
|
||||
|
||||
For a steady stream of TILs, [sign up for my newsletter](https://crafty-builder-6996.ck.page/e169c61186).
|
||||
|
||||
_1604 TILs and counting..._
|
||||
_1608 TILs and counting..._
|
||||
|
||||
See some of the other learning resources I work on:
|
||||
- [Ruby Operator Lookup](https://www.visualmode.dev/ruby-operators)
|
||||
@@ -54,6 +54,7 @@ If you've learned something here, support my efforts writing daily TILs by
|
||||
* [Linux](#linux)
|
||||
* [LLM](#llm)
|
||||
* [Mac](#mac)
|
||||
* [Mise](#mise)
|
||||
* [MongoDB](#mongodb)
|
||||
* [MySQL](#mysql)
|
||||
* [Neovim](#neovim)
|
||||
@@ -326,6 +327,7 @@ If you've learned something here, support my efforts writing daily TILs by
|
||||
- [Exclude A File From A Diff Output](git/exclude-a-file-from-a-diff-output.md)
|
||||
- [Excluding Files Locally](git/excluding-files-locally.md)
|
||||
- [Extend Git With Custom Commands](git/extend-git-with-custom-commands.md)
|
||||
- [Files With Local Changes Cannot Be Removed](git/files-with-local-changes-cannot-be-removed.md)
|
||||
- [Find And Remove Files That Match A Name](git/find-and-remove-files-that-match-a-name.md)
|
||||
- [Find The Date That A File Was Added To The Repo](git/find-the-date-that-a-file-was-added-to-the-repo.md)
|
||||
- [Find The Initial Commit](git/find-the-initial-commit.md)
|
||||
@@ -686,6 +688,10 @@ If you've learned something here, support my efforts writing daily TILs by
|
||||
- [View All Windows Of The Current App](mac/view-all-windows-of-the-current-app.md)
|
||||
- [Write System Clipboard To A File](mac/write-system-clipboard-to-a-file.md)
|
||||
|
||||
### Mise
|
||||
|
||||
- [List The Files Being Loaded By Mise](mise/list-the-files-being-loaded-by-mise.md)
|
||||
|
||||
### MongoDB
|
||||
|
||||
- [Determine The Database Version](mongodb/determine-the-database-version.md)
|
||||
@@ -1534,6 +1540,7 @@ If you've learned something here, support my efforts writing daily TILs by
|
||||
- [File Type Info With File](unix/file-type-info-with-file.md)
|
||||
- [Find All Files Matching A Name With fd](unix/find-all-files-matching-a-name-with-fd.md)
|
||||
- [Find All Files With A Specific Extension With fd](unix/find-all-files-with-a-specific-extension-with-fd.md)
|
||||
- [Find All Tool Version Files Containing Postgres](unix/find-all-tool-version-files-containing-postgres.md)
|
||||
- [Find Any Dotfiles That Modify Path Env Var](unix/find-any-dotfiles-that-modify-path-env-var.md)
|
||||
- [Find A File Installed By Brew](unix/find-a-file-installed-by-brew.md)
|
||||
- [Find Duplicate Lines In A File](unix/find-duplicate-lines-in-a-file.md)
|
||||
@@ -1847,6 +1854,7 @@ If you've learned something here, support my efforts writing daily TILs by
|
||||
- [Convert An ePub Document To PDF On Mac](workflow/convert-an-epub-document-to-pdf-on-mac.md)
|
||||
- [Create A Local Sanity Dataset Backup](workflow/create-a-local-sanity-dataset-backup.md)
|
||||
- [Create A Public URL For A Local Server](workflow/create-a-public-url-for-a-local-server.md)
|
||||
- [Create Todo Items In Logseq](workflow/create-todo-items-in-logseq.md)
|
||||
- [Enable Dev Tools For Safari](workflow/enable-dev-tools-for-safari.md)
|
||||
- [Forward Stripe Events To Local Server](workflow/forward-stripe-events-to-local-server.md)
|
||||
- [Get URL For GitHub User Profile Photo](workflow/get-url-for-github-user-profile-photo.md)
|
||||
|
||||
26
git/files-with-local-changes-cannot-be-removed.md
Normal file
26
git/files-with-local-changes-cannot-be-removed.md
Normal file
@@ -0,0 +1,26 @@
|
||||
# Files With Local Changes Cannot Be Removed
|
||||
|
||||
This is a nice quality-of-life feature in `git` that should help you avoid
|
||||
accidentally discarding changes that won't be retrievable.
|
||||
|
||||
```bash
|
||||
❯ git rm .tool-versions
|
||||
error: the following file has local modifications:
|
||||
.tool-versions
|
||||
(use --cached to keep the file, or -f to force removal)
|
||||
```
|
||||
|
||||
My `.tool-versions` file has some local changes. I don't realize that and I go
|
||||
to issue a `git rm` command on that file. Instead of quietly wiping out my
|
||||
changes, `git` lets me know I'm doing something destructive (these local
|
||||
changes won't be in the diff or the reflog).
|
||||
|
||||
I can force the removal if I know what I'm doing with the `-f` flag. Or I can
|
||||
take the two step approach of calling `git restore` on that file and then `git
|
||||
rm`.
|
||||
|
||||
The `--cached` flag is also interesting because it doesn't actually delete the
|
||||
file from my file system, but it does stage the file deletion with `git`. That
|
||||
means the file now shows up as one of my untracked files.
|
||||
|
||||
See `man git-rm` for more details.
|
||||
@@ -5,6 +5,8 @@ an array-like object with all of the arguments to the function. Even if not
|
||||
all of the arguments are referenced in the function signature, they can
|
||||
still be accessed via the `arguments` object.
|
||||
|
||||
> For ES6+ compatibility, the `spread` operator used via [rest parameters](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/rest_parameters) is preferred over the `arugments` object when accessing an abritrary number of function arguments.
|
||||
|
||||
```javascript
|
||||
function argTest(one) {
|
||||
console.log(one);
|
||||
|
||||
29
mise/list-the-files-being-loaded-by-mise.md
Normal file
29
mise/list-the-files-being-loaded-by-mise.md
Normal file
@@ -0,0 +1,29 @@
|
||||
# List The Files Being Loaded By Mise
|
||||
|
||||
While running `mise` for the first time, after adding a `mise.toml` file to a
|
||||
project, I noticed something strange. Instead of invoking the command I had
|
||||
specified (`mise run dev`), several parellel tool downloads were kicked off. In
|
||||
addition to Ruby, it was installing an older version of Postgres, and lua. What
|
||||
gives?
|
||||
|
||||
By running `mise cfg`, I can list all the files being loaded by `mise` and get
|
||||
to the bottom of this.
|
||||
|
||||
```bash
|
||||
mise cfg
|
||||
|
||||
Path Tools
|
||||
~/.tool-versions node, ruby, postgres, lua
|
||||
~/code/still/.ruby-version ruby
|
||||
~/code/still/Gemfile (none)
|
||||
~/code/still/.tool-versions ruby
|
||||
~/code/still/mise.toml (none)
|
||||
```
|
||||
|
||||
I was only thinking about the files local to my project and I forgot that I
|
||||
have a system-wide `.tool-versions` file. As we can see from the output, that
|
||||
file specifies `postgres` and `lua` as well. Mise wanted to ensure that it had
|
||||
downloaded the specified versions of each of those tools before running my
|
||||
task.
|
||||
|
||||
[source](https://mise.jdx.dev/configuration.html)
|
||||
38
unix/find-all-tool-version-files-containing-postgres.md
Normal file
38
unix/find-all-tool-version-files-containing-postgres.md
Normal file
@@ -0,0 +1,38 @@
|
||||
# Find All Tool Version Files Containing Postgres
|
||||
|
||||
I've been using [`asdf`](https://asdf-vm.com/) for many years now which means I
|
||||
have projects and directories all over my machine with `.tool-versions` files.
|
||||
Many of them specify Ruby and Node versions. Some of them also include
|
||||
PostgreSQL versions. I used to use `asdf` to manage Postgres versions, but no
|
||||
longer do that for new or active projects.
|
||||
|
||||
I want to find all the places that a `.tool-versions` file declares `postgres`
|
||||
as a tool. That way I can begin to clean up the left behind artifacts of
|
||||
asdf-managed Postgres.
|
||||
|
||||
By combining [`fd`](https://github.com/sharkdp/fd) (a better `find`) and
|
||||
[`rg`](https://github.com/BurntSushi/ripgrep) (a better `grep`), I'm able to
|
||||
quickly track down the list of places.
|
||||
|
||||
```bash
|
||||
$ fd --hidden .tool-versions ~/ | xargs rg postgres
|
||||
|
||||
/Users/jbranchaud/.local/state/nvim/undo/%Users%jbranchaud%.tool-versions: binary file matches (found "\0" byte around offset 9)
|
||||
|
||||
/Users/jbranchaud/code/fake-data/.tool-versions
|
||||
2:postgres 13.1
|
||||
|
||||
/Users/jbranchaud/code/thirty_days/thirty_days_server/.tool-versions
|
||||
1:postgres 13.1
|
||||
|
||||
/Users/jbranchaud/code/visualmode/.tool-versions
|
||||
1:postgres 11.11
|
||||
```
|
||||
|
||||
That first instance is a binary file as part of `nvim`'s undo history which I
|
||||
can ignore. The other three are good results.
|
||||
|
||||
I tell the `fd` command to not exclude hidden files as it looks for all
|
||||
occurrences of `.tool-versions` recursively from my home (`~/`) directory. I
|
||||
then pipe that list of files to `xargs` which makes those filenames arguments
|
||||
to the `rg postgres` command.
|
||||
32
workflow/create-todo-items-in-logseq.md
Normal file
32
workflow/create-todo-items-in-logseq.md
Normal file
@@ -0,0 +1,32 @@
|
||||
# Create Todo Items In Logseq
|
||||
|
||||
Having used GitHub flavored markdown and tools like Roam Research and Obsidian,
|
||||
I'm used to being able to add interactive todo items to a document with square
|
||||
brackets, like so:
|
||||
|
||||
```
|
||||
- [ ] Do this
|
||||
- [ ] Do that
|
||||
```
|
||||
|
||||
This exact syntax doesn't work in Logseq, but I've figured out two ways of
|
||||
adding todo items.
|
||||
|
||||
First, you can access the todo syntax with a forward slash command. Type `/`
|
||||
and then start typing `TODO`. It will show up as a top result. Hit enter and
|
||||
you'll have a fresh todo item that you can add a description to.
|
||||
|
||||
Second, as the above hints at, we can get right to the todo syntax by typing
|
||||
one of `TODO`, `NOW`, or `LATER` in all caps followed by a description. For
|
||||
example:
|
||||
|
||||
```
|
||||
TODO Send out invoices
|
||||
NOW Reply to those emails
|
||||
LATER Schedule that meeting
|
||||
```
|
||||
|
||||
These will render as checkable boxes marked as either `TODO`, `NOW`, or
|
||||
`LATER`, until they are checked off.
|
||||
|
||||
You can also search for blocks that match one of these three categories.
|
||||
Reference in New Issue
Block a user