1
0
mirror of https://github.com/jbranchaud/til synced 2026-01-19 06:58:02 +00:00

Compare commits

..

1 Commits

Author SHA1 Message Date
nick-w-nick
dc89e04141 Merge 295fe153ad into 48278c4908 2025-01-23 13:41:14 -05:00
3 changed files with 1 additions and 72 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).
_1574 TILs and counting..._
_1572 TILs and counting..._
See some of the other learning resources I work on:
- [Ruby Operator Lookup](https://www.visualmode.dev/ruby-operators)
@@ -1032,7 +1032,6 @@ See some of the other learning resources I work on:
- [Migrating Up Down Up](rails/migrating-up-down-up.md)
- [Mock Rails Environment With An Inquiry Instance](rails/mock-rails-environment-with-an-inquiry-instance.md)
- [Order Matters For `rescue_from` Blocks](rails/order-matters-for-rescue-from-blocks.md)
- [Override Text Displayed By Form Label](rails/override-text-displayed-by-form-label.md)
- [Params Includes Submission Button Info](rails/params-includes-submission-button-info.md)
- [Params Is A Hash With Indifferent Access](rails/params-is-a-hash-with-indifferent-access.md)
- [Parse Query Params From A URL](rails/parse-query-params-from-a-url.md)
@@ -1828,7 +1827,6 @@ See some of the other learning resources I work on:
- [Rotate An Image To Be Oriented Upright](workflow/rotate-an-image-to-be-oriented-upright.md)
- [See Overlaps For A Set Of Time Zones](workflow/see-overlaps-for-a-set-of-time-zones.md)
- [Send A Message To A Discord Channel](workflow/send-a-message-to-a-discord-channel.md)
- [Send A PDF To Your Kindle](workflow/send-a-pdf-to-your-kindle.md)
- [Set Recurring Reminders In Slack](workflow/set-recurring-reminders-in-slack.md)
- [Show Linting Errors In Zed](workflow/show-linting-errors-in-zed.md)
- [Temporarily Hide CleanShot X Capture Previews](workflow/temporarily-hide-cleanshot-x-capture-previews.md)

View File

@@ -1,38 +0,0 @@
# Override Text Displayed By Form Label
Rails does a good job with the default text displayed by a form label. It takes
the primary symbol value you give it and capitalizes that. And that is often
good enough.
```ruby
<%= form_with(model: post) do |form| %>
<%= form.label :title, class: "text-sm font-medium text-gray-700" %>
<%= form.text_field :title, required: true, class: "..." %>
<% end %>
```
This will yield a label value of _Title_.
Sometimes, however, the casing needs to be different or you need entirely
different text. Take this URL field for example. Rails will convert `:url` into
_Url_ for the label text. Not ideal. I can override the default with a second
positional argument, in this case, `"URL"`.
```ruby
<%= form_with(model: post) do |form| %>
<%= form.label :url, "URL", class: "text-sm font-medium text-gray-700" %>
<%= form.url_field :url, required: true, class: "..." %>
<% end %>
```
The [Rails docs have another good
example](https://guides.rubyonrails.org/form_helpers.html#a-generic-search-form).
A label with a value of `query` that is overridden to display "Search for:".
```ruby
<%= form_with url: "/search", method: :get do |form| %>
<%= form.label :query, "Search for:" %>
<%= form.search_field :query %>
<%= form.submit "Search" %>
<% end %>
```

View File

@@ -1,31 +0,0 @@
# Send A PDF To Your Kindle
I recently got a Kindle. I already have a bunch of PDF and ePub books on my
computer that I've bought over the years. I wanted to be able to read some of
those books on the Kindle. I found that there is a way to send these formats to
your Kindle via email.
There are a couple steps to get this working.
First, from the Amazon account that is tied to the Kindle device, open the
_Account_ dropdown and click _Devices. Any devices tied to your account will be
listed there. Navigate to the one you want to send to. Under the _Device
Summary_ with be a custom email address for that device. Something like
`youremail_abc123@kindle.com`.
That's the email you'll send the PDF or ePub attachment to.
Second, that Kindle email address will only receive and process documents from
a known, verified email address. Back on the _Devices_page, click on the
_Preferences_ tab. Under _Personal Document Preferences_ make sure that the
_Approved Personal Document Email List_ includes the email address you'll be
sending from. Add it if not.
Everything is set up. Now compose an email to that Kindle address, add the
attachment, and send. Give it 5 or so minutes to process and it should show up
on your device.
Additionally, you can go to the _Content_ tab and then to _Digital Content_ to
see what documents you have set and which devices have received them.
[source](https://goodereader.com/blog/kindle/here-is-how-you-can-read-pdf-files-on-the-amazon-kindle)