1
0
mirror of https://github.com/jbranchaud/til synced 2026-03-04 23:18:44 +00:00

Compare commits

...

2 Commits

Author SHA1 Message Date
jbranchaud
aaf7da413c Add Hide Overflowing Text For Google Sheets Column as an Internet TIL 2026-01-10 14:04:11 -06:00
jbranchaud
6a2a0a8ac1 Add Diff Two Files In Unified Format as a Unix TIL 2026-01-10 13:28:46 -06:00
3 changed files with 93 additions and 1 deletions

View File

@@ -10,7 +10,7 @@ working across different projects via [VisualMode](https://www.visualmode.dev/).
For a steady stream of TILs, [sign up for my newsletter](https://visualmode.kit.com/newsletter).
_1723 TILs and counting..._
_1725 TILs and counting..._
See some of the other learning resources I work on:
@@ -550,6 +550,7 @@ If you've learned something here, support my efforts writing daily TILs by
- [Focus The URL Bar](internet/focus-the-url-bar.md)
- [Get Random Images From Unsplash](internet/get-random-images-from-unsplash.md)
- [Grab The RSS Feed For A Substack Blog](internet/grab-the-rss-feed-for-a-substack-blog.md)
- [Hide Overflowing Text For Google Sheets Column](internet/hide-overflowing-text-for-google-sheets-column.md)
- [Search Tweets By Author](internet/search-tweets-by-author.md)
- [Show All Pivotal Stories With Blockers](internet/show-all-pivotal-stories-with-blockers.md)
- [Verify Site Ownership With DNS Record](internet/verify-site-ownership-with-dns-record.md)
@@ -1641,6 +1642,7 @@ If you've learned something here, support my efforts writing daily TILs by
- [Curling For Headers](unix/curling-for-headers.md)
- [Curling With Basic Auth Credentials](unix/curling-with-basic-auth-credentials.md)
- [Determine ipv4 And ipv6 Public IP Addresses](unix/determine-ipv4-and-ipv6-public-ip-addresses.md)
- [Diff Two Files In Unified Format](unix/diff-two-files-in-unified-format.md)
- [Different Ways To Generate A v4 UUID](unix/different-ways-to-generate-a-v4-uuid.md)
- [Display All The Terminal Colors](unix/display-all-the-terminal-colors.md)
- [Display Free Disk Space](unix/display-free-disk-space.md)

View File

@@ -0,0 +1,12 @@
# Hide Overflowing Text For Google Sheets Column
I imported a big CSV into a new Google Sheets document. This included a
"Description" column with many of the descriptions varying between 50 and 80
characters. The bottom line is that the description column was flowing over the
top of the columns next to it. Instead of expanding the width of that column as
far as the largest description, I wanted to hide the _overflow_.
The way to do this in Google Sheets is to highlight the entire column by
clicking on the column grouping. Then under the _Format_ menu item is a
_Wrapping_ submenu. The _Clip_ option is what I was looking for because it clips
the text that gets shown at the edge of the column.

View File

@@ -0,0 +1,78 @@
# Diff Two Files In Unified Format
The `diff` command is a standalone utility that can be used to get the
difference between two files. It is similar to what you might expect when
running `git diff` which compares two different versions of the same file. The
`diff` command predates `git` and its unified format is what became the standard
that `git` uses for its own diff implementation.
Running `diff` with two files as is gives output like the following:
```bash
diff startup.sh startup2.sh
10,13c10,14
< declare -A SESSIONS=(
< ["TIL"]="$HOME/dev/jbranchaud/til:setup_til"
< ["PLP"]="$HOME/dev/jbranchaud/pool-league-pro:"
< ["client-app"]="$HOME/dev/client/client-app:"
---
> # Sessions will be created in the order listed here
> SESSIONS=(
> "TIL:$HOME/dev/jbranchaud/til:setup_til"
> "PLP:$HOME/dev/jbranchaud/pool-league-pro:"
> "client-app:$HOME/dev/client/client-app:"
73,74c74,75
< for session_name in TIL PLP client-app; do
< IFS=':' read -r directory setup_function <<<"${SESSIONS[$session_name]}"
---
> for session_config in "${SESSIONS[@]}"; do
> IFS=':' read -r session_name directory setup_function <<<"$session_config"
```
That's readable at a glance, but the unified format (with the `-u` flag) can
provide more context:
```bash
diff -u startup.sh startup2.sh
--- startup.sh 2026-01-10 12:46:52
+++ startup2.sh 2026-01-10 12:48:00
@@ -7,10 +7,11 @@
# Session configurations
# Format: "session_name:directory:setup_function"
-declare -A SESSIONS=(
- ["TIL"]="$HOME/dev/jbranchaud/til:setup_til"
- ["PLP"]="$HOME/dev/jbranchaud/pool-league-pro:"
- ["client-app"]="$HOME/dev/client/client-app:"
+# Sessions will be created in the order listed here
+SESSIONS=(
+ "TIL:$HOME/dev/jbranchaud/til:setup_til"
+ "PLP:$HOME/dev/jbranchaud/pool-league-pro:"
+ "client-app:$HOME/dev/client/client-app:"
)
# Setup function for TIL session
@@ -70,8 +71,8 @@
echo ""
# Create sessions in order
- for session_name in TIL PLP client-app; do
- IFS=':' read -r directory setup_function <<<"${SESSIONS[$session_name]}"
+ for session_config in "${SESSIONS[@]}"; do
+ IFS=':' read -r session_name directory setup_function <<<"$session_config"
create_session "$session_name" "$directory" "$setup_function"
done
```
Here we get additional context like surrounding lines and file name details.
While this is useful on its own, it also has the added benefit of making the
output compatible with other tools we may already be using. For instance, I'm
already using [delta](https://github.com/dandavison/delta) as my [git pager](https://github.com/jbranchaud/dotfiles/blob/main/gitconfig#L51) and [git differ](https://github.com/jbranchaud/dotfiles/blob/main/gitconfig#L139).
With the unified format, I can pipe the output directly to `delta` to get a
better view of the diff that is colorized and includes syntax highlighting.
```bash
diff -u startup.sh startup2.sh | delta
```