On some of our older projects, we use the mysql2 gem. Unfortunately, versions 0.2.x (required for Rails 2.3) and...
...issue with this pattern/approach. What's happening? Consider these classes: class Post < ActiveRecord::Base belongs_to :thread def thread_title thread.title end end class Thread < ActiveRecord::Base has_many :posts...
...post.thread is not actually a Thread even though looking at its class makes you believe so: post.thread.class => Thread Its real class is ActiveRecord::Associations::BelongsToAssociation which is sometimes exposed, for...
...being used by default (which may be annoying). Here is how to do that. Beware: By following the steps below, you will drop and recreate your cluster. You will lose...
...As an example, we will be modifying 9.5 main (running on port 5435) below. Become a PostgreSQL superuser sudo su postgres Backup entire database pg_dumpall -p 5435 > 5435.sql
...to name any file @imported by SASS with a leading underscore. SASS files not beginning with an underscore will be rendered on their own, which will fail if they are...
const wordBreaks = { 'Fahrsicherheitstraining': "Fahr\xADsicherheits\xADtraining", 'Fahrsicherheitszentrum': 'Fahr\xADsicherheits\xADzentrum', 'Kreisverkehrswacht': 'Kreis\xADverkehrswacht', 'Berufsgenossenschaft': 'Berufs\xADgenossenschaft', } const keys = Object.keys(wordBreaks) function textNodes(node){ let textNodes = [] let walk = document.createTreeWalker(node...
...get rather expensive and doing it for every long word does not make it better, but in my case the pages are not very content-heavy and there is no...
When such a virtual attribute should contain integer values you might get unexpected behavior with forms, because every param is a string and you don't get the magic...
...export_path = Dir.mktmpdir('exports') # ... ensure FileUtils.remove_entry(export_path) end Option 3: Using a before/after block before { @export_path = Dir.mktmpdir('exports') } after do if @export_path.present? FileUtils.remove_entry(@export_path)
...switches to the clicked link. In a Jasmine spec I wanted to test this behaviour. Unpoly's up.hello emits an up:fragment:inserted event, in whose callback function I can...
...guest from the CD, open a terminal (on the guest, not the host!) and become root: sudo su fdisk -l to see the disk information. \ There should be one drive...
When deploying code with Capistrano (depending on your configuration) at some point Capistrano tries to check out code from your...
Cookies without an expiration timestamp are called "session cookies". [1] They should only be kept until the end of the...
Inspired by recent "git shortcut" cards I figured it would be nice to have one of these for rebasing a...
This note describes how to kick a user out of a Rails application after she hasn't requested an action...
tl;dr: Use event.currentTarget unless you are absolutely certain that you need event.target. Since it hasn't been written down...
Due to the way we setup Jasmine tests in our projects, you may run into various errors when Jasmine boots...
Terminator has a cool feature that allows you to split your terminal into many panels and type in all of...
tl;dr Since Rails 7+ you can use ComparisonValidator for validations like greater_than, less_than, etc. on dates, numerics...
Our CI setup frequently sees this error while running yarn install: yarn install v1.22.19 [1/4] Resolving packages... [2/4] Fetching packages...
...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...
Git allows you to set push options when pushing a branch to the remote. You can use this to build...
Usually, Unpoly compiler destructors are returned from the compiler function. However, when using async compiler functions, you can not register...
...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...
...a lot more, you can think of it as a "Browserstack for mail clients". Best practices Use tables for layouting. Use these HTML attributes: align="center", width="100%", valign="top...
...In a second tab, open a preview of your designed HTML mail. It's best to take it from Staging, so that assets (images!) will be available to litmus during...