It's every developer's nightmare: SQL queries that get large and unwieldy. This can happen fairly quickly with the addition of multiple joins, a subquery and some complicated filtering...
...logic. I have personally seen queries grow to nearly one hundred lines long in both the financial services and health industries. Luckily Postgres provides two ways to encapsulate large queries...
...but REST itself - in a nutshell. so here's a new angle i've started playing with: "REST Upside Down...
Selenium cannot reliably control a browser when its window is not in focus, or when you accidentally interact with the browser frame. This will result in flickering tests, which are...
...tests to complete. The solution is to run Selenium inside a VNC session so the Selenium-controlled browser doesn't pop up over your main work area. Understanding issues with...
When receiving a new SSL-Certificate for an existing SSL-key it should be checked that they match cryptographically. Maybe the customer accidentally created a new key and certificate and...
...sent us just the certificate. It's also possible that the certificate chain is in the wrong order. Make sure that the server certificate is the first. This is also...
...end up with web page bloat. But loading a webpage is much more than shipping bytes down the wire. Once the browser has downloaded our page’s scripts it then...
...dive into this phase for JavaScript, why it might be slowing down your app’s start-up & how you can fix it. The article author also tested 6000+ production sites...
...below if you are affected by the issue: The field's content "" did not match "some-text" (RSpec::Expectations::ExpectationNotMetError) Issue with headless Chrome After removing the line above in...
...it could happen that the tests are no longer running in headless mode. Updating the selenium-webdriver gem to >= 3.13.0 fixed the problem. Issue with old Capybaras
The linked article provides a good overview of the various concurrency primitives in Ruby, and what's changing in Ruby...
...duplication from the code is a seemingly easy task. In many cases it is pretty straight-forward – you look at similar bits of code and you move them to a...
...in other places. Right? No, not really. It is true that code that looks similar might be an indicator that there’s a duplication but it’s not the definitive...
Webfonts are not always available when your JavaScript runs on first page load. Since fonts may affect element sizes, you may want to know when fonts have been loaded to...
...Promise that will be resolved once the font is available. Example: document.fonts.load('1rem "Open Sans"').then(() => {...
jQuery / fontSpy If your project uses jQuery, you could also use jQuery-FontSpy which...
If your Webpack build is slow, you can use the Speed Measure Plugin for Webpack to figure out where time is being spent. Note that at time of writing, Webpack...
...now have an idea where optimization might be feasible. Look around for suggestions, e.g. the sass-loader readme when you want to optimize Sass build time...
...formatting. Headers, paragraphs, lists, it’s all good. What about the formatting of text in single-line text fields? If our form entry is a single line, that’s usually...
...on an old version of ImageMagick that you can no longer install in your system, you can choose the run an old ImageMagick in a Docker container. Dockerized ImageMagick commands...
...path arguments. You need to boot a corresponding docker container once before using it. Setting up Docker If you haven't installed Docker yet, use our guide or the official...
...behavior of deprecated code in your Ruby project, the warning messages littered throughout your spec output is incredibly noisy. You could silence all warnings with ::ActiveSupport::Deprecation.silenced = true, but you...
...dependencies. It’s tempting to remove the tests altogether (the code will be burned soon too, right?), but I figured out something a little nicer a little while back in...
...an npm package. Naming convention for pre-release versions An npm package must use Semantic Versioning's naming convention for its version. In Semantic Versioning, the version number and pre...
...release identifier (like rc1) must be separated by a dash, like this: 1.0.0-rc1 2.3.0-alpha2 3.0.0-beta3 Publishing to a pre-release tag npm packages have multiple "current" releases...
Find conditions for scopes can be given either as an array (:conditions => ['state = ?', 'draft']) or a hash (:conditions => { 'state' => 'draft' }). The later is nicer to read, but has horrible security...
...versions of Ruby on Rails. Affected versions Version Affected? Remedy 2.3.18 yes Use chain_safely workaround 3.0.20 no 3.1.x ??? 3.2.22 yes Use Rails LTS 3.2 with hardened configuration...
...was missing some features on Ruby's RSS::Parser that I found in Feedjira: Speed Does not break on slightly malformed RSS feeds (like a missing length attribute on an...
When you're facing a somewhat complex Google Analytics setup and want to find out what's happening, you can use this Chrome extension. It's much simpler than other...
...like "Google Tag Assistant") and does just one job and does it well. To see what's happening, you need to open your developer console...
The team is responsible for building great software—that’s it. It’s the only thing the team is responsible for and it’s the only thing that they actually...
...control. In other words, the development team is committed to quality software...
In large forms (30+ controls) new Capybara version become [extremely slow] when filling out fields. It takes several seconds per input. The reason for this is that Capybara generates a...
...huge slow XPath expression to find the field. The attached code patches fill_in with a much faster implementation. It's a dirty fix and probably does a lot less...
Since May 2011 we are cutting new gems using Bundler, which is less painful than cutting gems using Jeweler. You know a gem was cut using Bundler if you see...
This is how to update a gem that was cut using Bundler: Say git pull or check out a repository from Github like git clone git@github.com:makandra/geordi.git
Ruby's String#split returns an array of substrings from the given string. Usually, this is missing the split characters: >> 'user@example.com'.split('@') => ["user", "example.com"] If you want to join those...
...parts later on, you might know the split character and can just use it to join explicitly. But if you split by a regular expression (for a set of split...
...was typical approach for object oriented languages, designed in the 90s. A thread is sequence of instructions that can be scheduled and executed in the context of a process. Several...
...at the same time. Ruby’s VM process allocates a memory heap, which is shared and writable by threads. If incorrectly coordinated, those threads can lead to unexpected behaviors...
...methods and properties) video = document.querySelector('video') video.play() video.pause() video.load() // Reset to the beginning and select the best available source video.currentSrc // The selected source video.currentTime // The current playback time (in seconds...
...video.ended // Whether the video has finished video.muted video.paused video.readyState // See comments video.volume Comments controls makes the browser show its own video controls The image given in poster will be shown...
Sometimes you want to have a time in a given timezone independent from you Rails timezone settings / system timezone. I usually have this use case in tests. Example
...results e.g. 2020-08-09 00:00:00 +0200 depending on the Rails timezone settings / system timezone. But in this example we always want to have the given time in...