The nokogiri gem provides different packages for several platforms. Each platform-specific variant ships pre-built binaries of libxml2, e.g. x86_64-linux includes binaries for 64bit Linux on Intel/AMD...
...This significantly speeds up installation of the gem, as Nokogiri no longer needs to compile libxml2. However, this also means that for each security issue with libxml2, Nokogiri maintainers have...
...for file uploads. CarrierWave has an integrated processing mechanism for different file versions with support for ImageMagick through CarrierWave::MiniMagick (which requires the mini_magick gem). In case your processing...
...runs into an error, CarrierWave will just swallow it and rethrow an error with a very generic message like Processing failed. Maybe it is not an image? which does not...
makandra's development process Learn about our process. The squares represent the state of the issue in Linear: In particular you should understand: Why do we have a process?
...is an issue (formerly: story)? What metrics does our process optimize for? How to divide large requirements into issues. When is an issue too small, when is it too large...
Debouncing a method call delays its execution until after a specified time has passed. If it's called again before that time has passed, its execution is delayed again.
...would be run more often than it needs to. One example for that are scroll event handlers in JavaScript: You want to react to a user scrolling, but it's...
...of a Linux process, like so: $ faketime 'last Friday 4 pm' date Fr 12. Sep 16:00:00 CEST 2025 However, we cannot just modify the time of the docker...
...need to affect the command being run inside the image. So we need to smuggle faketime into the container somehow, and activate it for the process being run.
...notice that the records you create are not deleted and will bleed into your specs the next time you run them. You probably have DatabaseCleaner configured to take care of...
...not bloating your test database with old records: RSpec.configure do |config| config.before(:suite) do DatabaseCleaner.clean_with(:deletion) end config.before(:each) do DatabaseCleaner.strategy = :transaction end config.before(:each, transaction: false) do DatabaseCleaner.strategy...
Static error pages To add a few basic styles to the default error pages in Rails, just edit the default templates in public, e.g. public/404.html. A limitation to these default...
...templates is that they're just static files. You cannot use Haml, Rails helpers or your application layout here. If you need Rails to render your error pages, you need...
...that matter) will not be affected by this. If you define them in your specs, they will exist globally. This is because of how RSpec works (short story: instance_eval...
# ... end let(:record) { TestRecord.new }
end # TestRecord will exist here, outside of the spec! Do not do this. It will bite you eventually. For example, when you try to...
You have uncommited changes (you can always check by using git status), which you want to discard. Context Now there are several options to discard these depending on...
...your exact situation. The headlines will differentiate the cases whether the files are staged or unstaged. Staged and unstaged changes Staged changes Unstaged Changes Staged and unstaged changes
...with two matchers that test for equality. The first is toBe: expect(first).toBe(second) toBe passes when first === second. Unfortunately this is useless for non-primitive values because JavaScript...
...is a horrible language. However, Jasmine comes with another matcher toEqual: expect(first).toEqual(second) This matcher behaves as a human would expect for types like the following: Arrays
...been released just a few days ago, allowing us to use Webpack 4. I successfully upgraded an existing real-world Webpack 3 application. Below are notes on everything that I...
Note that we prefer not using the Rails asset pipeline at all and serving all assets through Webpack for the sake of consistency. Preparations Remove version locks in Gemfile...
Because your examples should not change global state, you should not need to care about the order in which RSpec processes your .rb files. However, in some cases you might...
...rb files in alphabetical order of their file paths by default (or when you specify --order defined). You run tests in random order by using --order random on the command...
To make CSS rules dependent on the screen size, we use media queries: @media (max-width: 500px) { // rules for screen widths of 500px or smaller } Browsers will automatically enable and...
...disable the conditional rules as the screen width changes. To detect responsive breakpoints from JavaScript, you may use the global matchMedia() function. It is supported in all browsers:
I frequently find myself needing a combination of group_by, count and sort for quick statistics. Here's a method on Enumerable that combines the three: module Enumerable
group_by(&block) .transform_values(&:count) .sort_by(&:last) .to_h end end Just paste that snippet into a Rails console and use #count_by now! Usage examples...
Read the following material: World's shortest UI/UX design course Easiest Way to Pick UI Colors 7 Rules for Creating Gorgeous UI (Part 1) 7 Rules for Creating Gorgeous...
Visual design rules you can safely follow every time Bootstrapping Design (in our library) Steve Schoger's Refactoring UI book (in our library) and watch the following...
This card is a short summary on different ways of assigning multiple attributes to an instance of a class. Using positional parameters Using parameters is the default when assigning attributes...
...It works good for a small number of attributes, but becomes more difficult to read when using multiple attributes. Example: class User def initialize(salutation, first_name, last_name, street...
...Mocking the time zone You can't really change the local time zone of the Selenium-controlled browser. What you can do is change the time zone of the process...
...setting this from an individual test, since you don't know whether or not the Selenium-controlled browser has already launched. Note that we have only tested this with a...
...pretty_print method As an example, consider the following class. class MyClass # ... def inspect "#<#{self.class} attr1: #{attr1.inspect}, attr2: #{attr2.inspect}>" end end Instances of that class will inspect like #<MyClass attr1...
...Alice", attr2: "Bob">, but IRB will apply a single color (green) for everything. That is because MyClass implements only inspect. If it were to implement pretty_print, IRB would use...
When ending a Selenium test Capybara resets the browser state by closing the tab, clearing cookies, localStorage, etc. It may be a good idea to wait for all in-flight...
...AJAX requests to finish before ending a scenario: You may have client-side JavaScript that freaks out when the tab closure kills their pending requests. If that JavaScript opens an...
min-width is known as a CSS property that can be set to define a least width for an element. Surprisingly, it can also be used to set something that...
...it is more like "auto". This can make block elements take up much more space than desired, even stretching their container beyond the screen edge on small screens.
...if you do not know. How are cookies transferred between your browser and the server? Open the development tools in your browser for this page. Can you find the cookies...
...your browser stores for makandracards? In the network tab, can you see how the cookies are transferred to or from the server? Can you log yourself out by manipulating a...
I recently noticed a new kind of flaky tests on the slow free tier GitHub Action runners: Integration tests were running on smaller screen sizes than specified in the device...
...metrics. The root cause was the use of Selenium's page.driver.resize_window_to methods, which by design does not block until the resizing process has settled: We discussed this issue...
...files. Those can be used to apply to a different repository [1] or by someone else (e.g. sent when sent to them via e-mail). Creating a patch in git...
...changes and commit them. Run git format-patch COMMIT_REFERENCE to convert all commits since the referenced commit (not including it) into patch files. For example, let's say you...
...Learn to create test data effectively using factories. Decouple tests by having each test start with an empty database and create only the records needed for the test. Learn
...with every test. In our experience the use of fixtures can make a test suite hard to work with. In any non-trivial test suite there will be thousands of...