...a few minor changes. If you have the vcr and webmock gems installed, simply include: # spec/support/vcr.rb VCR.configure do |c| c.cassette_library_dir = Rails.root.join("spec", "vcr") c.hook_into :webmock end RSpec.configure...

...bar' # same thing h['foo'] # => 'bar' h.foo # => 'bar' in? (> 3.0 only) reverse of Array#include? characters = ["Konata", "Kagami", "Tsukasa"] "Konata".in?(characters) # => true Array.wrap wraps argument in an array, unless...

Here are some hints on best practices to maintain your tasks in larger projects. Rake Tasks vs. Scripts

mso-line-height-rule: exactly; line-height: 0; } Make sure to include mso-line-height-rule: exactly. Otherwise, MS Outlook will treat your line-height as a minimum...

In ruby you can easily read and write CSVs with the standard CSV library class. On top of this, you...

...database-specific tool like pg_dump, you can now serialize every single schema property, including proprietary features. Unfortunately using structure.sql comes with some disadvantages. Why structure.sql can churn wildly

...lot of noise and merge conflicts in your repository. Possible reasons for this churn include: Two developers use different versions of the database server (e.g. PostgreSQL 16 vs. 17).

...in your stylesheets. Usually this should not be a problem, but at times they include misleading Meta-information that leads to a strange error in the PDF. The setup

makandra dev
rails-sqli.org

...methods can open up code to SQL Injection exploits. The examples here do not include SQL injection from known CVEs and are not vulnerabilites themselves, only potential misuses of the...

...excludes spaces, control characters, and similar) /[[:lower:]]/ Lowercase alphabetical character /[[:print:]]/ Like [[:graph:]], but includes the space character /[[:punct:]]/ Punctuation character /[[:space:]]/ Whitespace character ([[:blank:]], newline, carriage return, etc.)

makandra dev

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...

...TypeScript, and modern browsers will run them natively. Features supported by all modern browsers include: fat arrow functions (() => { expr }) let / const class async / await Promises Generators Symbols Rest arguments (...args...

This card shows an uncommon way to retrieve a file using selenium where JavaScript is used to return a binary...

I recently noticed a new kind of flaky tests on the slow free tier GitHub Action runners: Integration tests were...

evilmartians.com

...suite of tools designed to improve the performance of Ruby test suites. Key tools include: EventProf: Measures the time spent on specific events during tests to identify slow processes.

Rails default config uses the ActiveSupport::Cache::NullStore and disables controller caching for all environments except production: config.action_controller.perform_caching = false...

...even if it spans over multiple elements in the HTML. Imagine a page that includes this HTML: Hi! Try to match me. Even though the text is separated by a...

makandra dev

There is no does method anymore We now use traits with the vanilla include method: class Article < ActiveRecord::Base include DoesTrashable end When your trait has parameters, use square...

class Article < ActiveRecord::Base include DoesStripFields[:name, :brand] end Note how you can now follow trait names by CTRL+clicking on them in RubyMine! New naming convention for traits...

...trait for validating the extensions and content types in all of your uploaders (by including it on the base uploader) and that it now looks like this: class BaseUploader

...in this trait, these lines should now be removed. class BaseUploader < CarrierWave::Uploader::Base include DoesStrictTypeValidations # ... end Now, in your uploaders... def extension_white_list %w[jpg jpeg gif png...

For Selenium tests, your browser starts in your local timezone, or whatever your system's environment specifies. This is usually...

If you need to make an HTTPS connection to a host which uses an expired certificate, do not disable certificate...

...hook will run after all scenarios have been executed. AfterAll do ... end You can include code to Cucumber in the World module without polluting the application namespace (example from...

regular-expressions.info

...w matches a word character (alphanumeric characters plus underscore) \s matches white space character (includes tabs and line breaks) \t matches tab character Non-Printable Characters \xFF matches hexadecimal character...

...combining international and local numbers, see example below) as the called number should not include that zero. def tel_to(text) groups = text.to_s.scan(/(?:^\+)?\d+/) if groups.size > 1 && groups...

...yet their concrete internal implementation and API differs in certain aspects. The last chapter includes a framework comparison table on the main APIs learnt throughout the book...