If you expect method calls in RSpec 3, be aware that the argument matchers use very liberal equality rules (more...

makandra dev

This talk shows simple and advanced usages of the ruby/debug debugger. It goes through a step by step debugging workflow...

When your Cucumber feature needs to browse the page HTML, and you are not sure how to express your query...

We're always striving towards keeping our website's JavaScript as small as possible. If you're using webpack(er...

makandra dev

This card is mainly an explanation how variable fonts work in CSS, not necessarily a recommendation to actually use them...

...the window's resize event, that might call your event listener many times. A better way is to subscribe to changes of the MediaQueryList object that is returned by matchMedia...

makandra dev

We structure our CSS using the BEM pattern. Our naming convention for blocks, elements and modifiers has evolved over the years. This card shows our current style and various alternative...

...not mix styles and be consistent within a given project. Current convention Our current BEM naming convention looks like this:

Note how the modifier just starts with a dash (-pro...

...update cucumber Make sure you have a recent version of geordi (it doesn't belong in your Gemfile!): gem install geordi Check if you're using Transforms Transform is no...

I frequently find myself needing a combination of group_by, count and sort for quick statistics. Here's a method...

...system's environment specifies. This is usually good enough. To test any timezone-dependent behavior in Chrome, you can change the time zone using the Chrome DevTools Protocol. Example

makandra dev

Enable local logging for Sentry when: Debugging Sentry event capture locally Testing error handling without polluting production metrics Developing background...

This guide shows how to create an AngularJS application that consumes more and more memory until, eventually, the browser process...

In long diffs, it can become impossible to spot small changes in larger blocks of moved code. This may be either a method that was moved from the top to...

...Capybara see the print stylesheet Capybara always requests as the screen medium. The step belows reloads the current page with a query param we will use in our layout to...

Capybara and most assistive technology will fail to find tags that are missing an href attribute. This will probably happen...

...file. Note that this is # not guaranteed to be 100% accurate. It performs a "best guess" based # on a simple test of the first +File.blksize+ characters. # # Example: # # File.binary?('somefile.exe') # => true...

...DateTime.strptime is not what you want You may eventually encounter DateTime.strptime. It's a "better" Time.parse where you can actually define the date format to parse, e.g. >> DateTime.strptime...

...If you use Rails' time_zone_select, you will be juggling zone names like "Berlin" which are actually unsupported. Unsupported zone identifiers are silently discarded and you'll end up...

Rails 7.1 added the normalizes method which can be used to normalize user input. It lets you define the fields...

...component is using this class to render and modify some html, it may fastly become boilerplate to define every call of the method. Here callFake comes in handy, because it...

...of any dependent on the received arguments without having to know the exact arguments beforehand: spyOn(Random, 'shuffle').and.callFake((array) => array.reverse()) Now you can just assume any result of your...

Development environment setup Rails Composer Basically a comprehensive Rails Template. Prepares your development environment and lets you select web server...

rspec.info

In modern default RSpec configurations, your tests are usually run in random order. This helps to detect "flickering" tests that...

When using Rails to truncate strings, you may end up with strings that are still too long for their container...

...to be performed around a deploy. Be it to notify operations about changed application behavior, be it to run a little oneline script after the deploy. Most database-related stuff...

} Enumerable#index_with (Rails 6+) To generate a hash where array elements become hash keys, and values are calculated from them, use index_with. users = User.all