HTML: Auto fill-in OTP received in text message (SMS)
Browsers can auto fill-in one time codes if advised. Use it like this:
<input autocomplete="one-time-code">
Demo: https://twitter.com/sulco/status/1320700982943223808 Show archive.org snapshot
Browser support is pretty good Show archive.org snapshot since mid-2022 (Chrome 93+, no Firefox).
Related cards:
Auto-generating plain-text bodies for HTML e-mails in Rails apps
When building an application that sends e-mails to users, you want to avoid those e-mails from being classified as spam. Most obvious scoring issues will not be relevant to you because you are not a spammer.
However, your application must do one ...
Thunderbird: How to compose an HTML e-mail (when plain-text messages are your default)
Nobody needs HTML e-mails. However, you occasionally might have to write an HTML message for some weird reason. Here is how:
- Hold the Shift-Key while clicking on "Write", "Reply", "Reply All", or "Forward".
That's it. :)
Click on a piece of text in Cucumber / Capyabra
The step definition below lets you write:
When I click on "Foo"
This is useful in Selenium features where the element you click on is not necessarily a link or button, but could be any HTML element with a Javascript event binding.
The e...
Haml: Fix problem with HTML-escaped single quotes in text fields
Haml 3.1.2 displays single quotes in FormBuilder#text_ field
html escaped. You may see something like that:
David's Chapter
Looking at the page's HTML, your field's values will be doubly escaped:
<input ... value="David&a...
Show hint in HTML 5 text fields
To have your text input field pre-filled in with some text that disappears as soon as the user selects it, use the attribute placeholder
:
<input type="text" placeholder="User name here">
This will only [work in recent browsers](http://...
Cucumber step to test that a tooltip text exists in the HTML
Tooltips that are delivered through HTML attributes are encoded. Decode entities before checking for their presence.
Capybara:
Then /^there should( not)? be a(n encoded)? tooltip "([^"]*)"$/ do |negate, encoded, tooltip|
tooltip = HTML...
Rails: Using PostgreSQL full-text search without a gem
PostgreSQL can cosplay as a full-text search engine. It doesn't have the features or fidelity of ElasticSearch or Algolia, but it's good enough if you just need to search and rank large volumes of text.
This card will teach you how to index, sear...
HTML: Making browsers wrap long words
By default, browsers will not wrap text at syllable boundaries. Text is wrapped at word boundaries only.
This card explains some options to make browsers wrap inside a long word like "Donaudampfschifffahrt"
.
Option 1: hyphens CSS property (pre...
WYSIWYG with Action Text
Rails 6 includes a WYSIWYG editor, Action Text. It works out of the box quite well, but chances are that you want to add some custom functionality. This card contains some tips how to ach...