makandra dev

This is a checklist I use to work on issues. For this purpose I extracted several cards related to the...

In the past we validate and set default values for boolean attributes in Rails and not the database itself.

Not all email clients support external images in all situations, e.g. an image within a link. In some cases, a...

Carrierwave's BaseUploader can have some validations that you can use by overriding a certain method, which's expected name...

Sometimes I ran across a GitHub merge request of a gem where it was not completely obvious in which version...

vertical-align is hard. Have you ever wanted to vertically center an icon with text? This usually means "vertically align...

Let's assume that we have a model Movie that registers a callback function when a new instance of Movie...

makandra dev
ruby-doc.org

TLDR if you define a equality method for a class you must also implement def hash. Ruby has a lot...

makandra dev

Timecop is a great gem to set the current time in tests. However, it is easy to introduce flakyness to...

Usually, design development starts with drafts, sketches and prototypes. These are reviewed, refined and iterated until the final design is...

makandra dev

In a Jasmine spec you want to spy on a function that is imported by the code under test. This...

We usually rely on VCR and WebMock to prevent any real network connection when running our unit tests.

You have some SVG files you want to use as icons on your website. How would you embed them?

Jasmine specs for the frontend often need some DOM elements to work with. Because creating them is such a common...

Jasmine specs that work with DOM elements often leave elements in the DOM after they're done. This will leak...

drafts.csswg.org

While in CSS zero is usually referenced without specifying a unit (e.g. padding: 0), you must not use a unitless...

Large Rails projects tend to define multiple custom ways to format Dates or DateTimes. This often leads to duplicated format...

sass >= 1.35.0 has the option quietDeps and silenceDeprecations to silence deprecation warnings from dependencies. quietDeps: No deprecation warnings for dependencies...

github.com

ActiveType::Object inherits from ActiveRecod::Base and is designed to behave like an ActiveRecord Object, just without the database...

Unpoly's [up-observe], [up-autosubmit] and [up-validate] as well as their programmatic variants up.observe() and up.autosubmit...

You can use ETags to allow clients to use cached responses, if your application would send the same contents as...

One rule of thumb I try to follow in capybara tests is using capybara matchers and not plain rspec matchers...

tl;dr In RubyMine you can use find and replace with capture groups (.*?) and backreferences $1 (if you have several...

Ruby's standard library includes a class for creating temporary directories. Similar to Tempfile it creates a unique directory name...