1
0
mirror of https://github.com/jbranchaud/til synced 2026-01-18 22:48:02 +00:00

Compare commits

...

4 Commits

Author SHA1 Message Date
Karim Bouchez
f7afb37c0e Merge 15337dfd71 into baab5738e7 2024-09-17 13:04:41 +04:00
jbranchaud
baab5738e7 Add Convert SVG To Favicon as a Unix TIL 2024-09-15 12:24:18 -05:00
jbranchaud
191c9d6d9d Add Generate A Rails App From The Main Branch as a Rails TIL 2024-09-09 11:57:10 -05:00
Karim Bouchez
15337dfd71 Update the old way to capture a GitHub Actions output
See [here](https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/) for more explanations:
> We are monitoring telemetry for the usage of these commands and plan to fully disable them on 31st May 2023. Starting 1st June 2023 workflows using save-state or set-output commands via stdout will fail with an error.
2023-02-12 10:36:45 +01:00
4 changed files with 61 additions and 4 deletions

View File

@@ -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).
_1439 TILs and counting..._
_1441 TILs and counting..._
---
@@ -897,6 +897,7 @@ _1439 TILs and counting..._
- [Find Or Create A Record With FactoryBot](rails/find-or-create-a-record-with-factory-bot.md)
- [Find Records With Multiple Associated Records](rails/find-records-with-multiple-associated-records.md)
- [Force All Users To Sign Out](rails/force-all-users-to-sign-out.md)
- [Generate A Rails App From The Main Branch](rails/generate-a-rails-app-from-the-main-branch.md)
- [Generating And Executing SQL](rails/generating-and-executing-sql.md)
- [Get A Quick Approximate Count Of A Large Table](rails/get-a-quick-approximate-count-of-a-large-table.md)
- [Get ActiveRecord Attribute Directly From Database](rails/get-active-record-attribute-directly-from-database.md)
@@ -1355,6 +1356,7 @@ _1439 TILs and counting..._
- [Command Line Length Limitations](unix/command-line-length-limitations.md)
- [Compare Two Variables In A Bash Script](unix/compare-two-variables-in-a-bash-script.md)
- [Configure cd To Behave Like pushd In Zsh](unix/configure-cd-to-behave-like-pushd-in-zsh.md)
- [Convert SVG To Favicon](unix/convert-svg-to-favicon.md)
- [Copying File Contents To System Paste Buffer](unix/copying-file-contents-to-system-paste-buffer.md)
- [Copying Nested Directories With Ditto](unix/copying-nested-directories-with-ditto.md)
- [Count The Lines In A CSV Where A Column Is Empty](unix/count-the-lines-in-a-csv-where-a-column-is-empty.md)

View File

@@ -23,11 +23,11 @@ version from my `.tool-versions` file with a step that uses `set-output`.
- name: Read Node.js version to install from `.tool-versions`
id: nodejs
run: >-
echo "::set-output name=NODE_VERSION::$(
echo "NODE_VERSION=$(
cat .tool-versions |
grep nodejs |
sed 's/nodejs \(.*\)$/\1/'
)"
)" >> $GITHUB_OUTPUT
```
`echo` runs the command in the string which sets `NODE_VERSION` as an output
@@ -45,4 +45,4 @@ This output value can be referenced in a later step.
`steps` has a reference to the `nodejs` step (note the `id` above) which then
has `outputs` like the `NODE_VERSION`.
[source](https://docs.github.com/en/actions/reference/workflow-commands-for-github-actions#using-workflow-commands-to-access-toolkit-functions)
[source](https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#setting-an-output-parameter)

View File

@@ -0,0 +1,27 @@
# Generate A Rails App From The Main Branch
Typically you are going to want to generate a Rails app using some officially
released version of the framework. These releases have been thoroughly tested,
have received patches, and can guarantee a certain level of stability.
However, if you are wanting to try out the latest, unreleased features, you may
want to generate a fresh Rails app based off the current state of the `main`
branch of the `rails` repository.
To do this, add the `--main` flag:
```bash
$ rails new rails_app_on_main --main
```
Toward the top of your app's `Gemfile`, you'll see that `rails` is pointed to
the `main` branch of their repo:
```ruby
# Use main development branch of Rails
gem "rails", github: "rails/rails", branch: "main"
```
See `rails new --help` for more details
[source](https://x.com/gregmolnar/status/1832720168264286571)

View File

@@ -0,0 +1,28 @@
# Convert SVG To Favicon
The imagemagick `convert` CLI tool can convert an SVG file into a transparent
favicon (ICO) file with the different standard sizes.
Assuming the background that we want to make transparent is white, then include
`-transparent white` and then to resize the icon include `-define
icon:auto-resize ...`. Point to the `image.svg` to be converted and specify the
name of the output file (`favicon.ico`).
```bash
$ convert image.svg -transparent white -define icon:auto-resize=16,32,48,64,128 favicon.ico
```
We can then use the `identify` CLI to inspect the `favicon.ico` file to see
that the above worked.
```bash
$ identify favicon.ico
favicon.ico[0] ICO 16x16 16x16+0+0 8-bit sRGB 0.000u 0:00.002
favicon.ico[1] ICO 32x32 32x32+0+0 8-bit sRGB 0.000u 0:00.004
favicon.ico[2] ICO 48x48 48x48+0+0 8-bit sRGB 0.000u 0:00.004
favicon.ico[3] ICO 64x64 64x64+0+0 8-bit sRGB 0.000u 0:00.004
favicon.ico[4] ICO 128x128 128x128+0+0 8-bit sRGB 99678B 0.000u 0:00.003
```
[source](https://www.joshmcarthur.com/2024/06/19/Auto-resizing-images-for-.ico-files.html)