PostgreSQL and ActiveRecord have a good support for storing dynamic attributes (hashes) in columns of type JSONB. But sometimes you...
tl;dr: Use event.currentTarget unless you are absolutely certain that you need event.target. Since it hasn't been written down...
If your Webpack build is slow, you can use the Speed Measure Plugin for Webpack to figure out where time...
Browsers blocks abusable JavaScript API calls until the user has interacted with the document. Examples would be opening new tab...
For each movie in MovieDB, we want to track which other movie it was inspired by. For...
...should see the following ([\w]+) table:?$/ do |name, expected_table| name = name.underscore table_element = begin element_at("table\##{name}") rescue Webrat::NotFoundError begin element_at("table.#{name}") rescue element_at...
...a "add new user" forms. Chrome developers say this is by design as they believe it encourages users to store more complex passwords. Recommended fix for Chrome and Firefox
Capybara allows you to select DOM elements, e.g. by using field, find_field(...) or field_labeled(...): role_select = field_labeled...
We recently encountered a problem with GlusterFS (7.x) when an application used the flock syscall on a GlusterFS path...
...calls html_safe if you're not escaping. FWIW, an HTML string may easily become invalid when truncated, e.g. when a closing tag gets chopped off. However, when the input...
When making cross-domain AJAX requests with jQuery (using CORS or xdomain or similar), you will run into issues with...
On your local system that only hosts non-critical development data and only you have access to, you can store...
...new value (be aware that you should use a secure and salted hash) or better call the the_user_to_log_out.reset_remember_token! method that does the things for you.
Rails comes with grouped_collection_select that appears to be useful, but isn't. As an alternative, consider the flat...
Note that you should disable the Java plug-in in your browsers after installation. Ubuntu >= 12.04 Java 11
CoffeeScript and JavaScript (ECMAScript) both have operators in and of. Each language use them for more than one purpose. There...
Spreewald's patiently repeats the given block again and again until it either passes or times out.
We often do some HTTP requests to fetch the data we want to check for certain criteria. Testing this in...
When you have many changes, and you want to spread them across different commits, here is a way to stage...
The Oracle mysql client has an odd behavior if your server uses latin1 as default character-set-server. Command mysql --version mysql Ver 8.0.31-0ubuntu0.20.04.2 for Linux on x86...
...character-set utf8 and set the character set inside the session to circumvent this behavior. Better solutions Use MariaDB mysql client The MariaDB mysql client handles the --default-character-set...
...polymorphic association. class Event < ApplicationRecord has_many :letters, as: :record end class Letter < ApplicationRecord belongs_to :record, polymorphic: true end event = Event.new.letters.build event.save! # => ActiveRecord::RecordInvalid: Validation failed: Record must exist...
If you need to run a program on a remote machine (e.g. to your office PC) with a graphical UI...
If you use transactional_fixtures or the database_cleaner gem with strategy :transaction, after_commit callbacks will not be fired...
...member', :home_page end It has some limitations: Only works for singular member references ("belongs to"), not for a collection of references ("has many") No support for deletion (but could...