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.
When you have an Angular directive that transcludes content, you might want to do something in case there is no content inside your element, like showing some default content.
...you can not do something like default goes here . Angular will always empty that element's text, even if there is nothing to transclude. But you can use your directive...
Since I use this a lot in my daily work and there were no scripts working properly for me, I made one myself. It's actually not bound to Xfce...
...t tried it, though). Installation If you don't yet have xdotool, install it: sudo apt-get install xdotool If you don't yet have wmctrl, install it:
Jasmine has long standing support for writing asynchronous specs. In days gone by we used the done callback to achieve this, but these days it is possible to write much...
...more readable specs. Async specs As a first example, say we want to check that some form disables the submit button while working. // bad (how we used to do it...
...have 2 HTML boxes. The first one has a margin-bottom of let's say 30px and the second one a margin-top of 20px. After rules of collapsing margins...
...too. For example child elements with margins also collapse with margins of the previous sibling of the parent box. Nevertheless there are some exceptions where the behavior of vertical collapsing...
...core and available in all ruby versions without the need to install anything. This serializes complete ruby objects including id, object_id and all internal state. Marshal.load deserializes a string...
...to an object. A deserialized object cannot be saved to database directly as the the dumped object was not marked dirty, thus rails does not see the need to save...
If the project you're working on has, say, 39 repositories and counting in GitLab and you need all the repos checked out for some reason, here's how to...
...a personal access token for GitLab that has the API permissions. In your terminal, store this key in an env variable. For each group you want to check out:
❌ Bad example Let's take a look at a common example: Clear Search The HTML above is being activated with an Unpoly compiler like this: up.compiler('[filter]', function...
...const queryInput = filterForm.querySelector('[filter--query]') function resetQuery() { queryInput.value = '' queryInput.focus() } up.on('click', resetQuery) }) The Clear search button has three issues: It cannot be focused with the keyboard It cannot be pressed...
Element finding is a central feature of Capybara. Since #find is normally used to get elements from the current page and interact with them, it's a good thing that...
...some Capybara drivers (e.g. Selenium) will wait an amount of time until the expected element shows up. But if Capybara cannot #find it at all, you'll get an error...
You can change which branches will be pushed when saying git push. Our recommendation is to set it to current. From the git-config documentation: push.default Defines the action git...
...branch, but forgot to setup tracking. If you can't currently push, use git branch --set-upstream-to=origin/$(git branch --show-current...
...you store files for 500k records, that store_dir's parent directory will have 500k sub-directories which will cause some serious headaches when trying to navigate the file system...
...still only have 500 directories inside /app-root/public/users/avatar/. And inside each of them, at most 1000 sub-directories. But I have millions of files If you expect to store a lot...
...measurement metrics in Linux. These are the differences: Code Name Description vsz virtual memory size Total amount of memory a process may hypothetically access. Includes swapped memory, memory from external...
...libraries and allocated memory that’s not used. rss resident set size Total amount of non-swapped used physical memory. Includes memory from external shared libraries. pss proportional share size...
...upgrade tasks according to its actual value. Consider to create and periodically maintain a summary, which helps you and your team in the decision which refactoring task should be taken...
Estimated Efforts Visible customer value Customer value explained Developer value Developer value explained Short title for the task Score from 0-5 Score from 0-5 Explanation
...updates all your gems at once. Given that many gems don't care about stable APIs, this might break your application in a million ways. To stay sane, update your...
...This ensures that your libraries are up-to-date while it's easy to spot major version bumps which may break the app. Projects that have not been updated in...
Using rem only ever makes sense when the root font size is dynamic, i.e. you leave control to the user. Either by a) respecting their user agent defaults, or...
...by b) offering multiple root font sizes in your application. By defining @media queries in rem, they will accommodate to the root font size of your page. At a larger...
...to do a VACUUM FULL without holding an exclusive lock during processing. There is still a need of one exclusive lock at the beginning and the end of the repacking...
Install pg_repack, e.g. for Ubuntu install the package according to your PostgreSQL Server version. There is no need to restart the PostgreSQL Server. $ sudo apt-get install postgresql...
Sometimes you'll find yourself with a set of tasks that require similar code for different models. For example, if you start working at a new application that allows CRUDing...
...pears and apples, each commit might look similar to this: commit 41e3adef10950b324ae09e308f632bef0dee3f87 (HEAD -> ml/add-apples-12345) Author: Michael Leimstaedtner <michael.leimstaedtner@acme.com> Date: Fri Aug 11 09:42:34 2023 +0200 Add Apples...
...a global variable in Rails? Ugh, that's the worst. If you need global state, you've probably reached for Thread.current. When you're using Thread.current, you must make sure...
...yourself or your cached data will stay in Thread.current. For Sidekiq, you can use request_store-sidekiq. Cronjobs are unaffected, as a new process is created each time...
...the following content: class AddAttachmentToNotes < ActiveRecord::Migration[6.0] def change add_column :notes, :attachment, :string end end Don't forget to rename the class and change the column details to...
...you access http://yourpage.com/system/attachments. 3) Using expiring URLs There are also option to generate self-expiring URLs, which might be a good compromise between performance and safety. It is...
...and Redis.current=: `Redis.current=` is deprecated and will be removed in 5.0. If your application still uses Redis.current, you can only fix it by no longer using it. Here is how...
...There is probably already a constant like REDIS_URL that you use to configure Sidekiq or similar. So just use that one. redis = Redis.new(url: REDIS_URL) redis.get('example') # instead...
Here are a few common patterns that will probably lead to flaky specs. If you notice them in your specs, please make sure that you have not introduced a flaky...
Using RSpec matchers One rule of thumb I try to follow in capybara tests is using capybara matchers and not plain rspec matchers. One example: visit(some_page)
It might sometimes be useful to check whether your Rails application accesses the file system unnecessarily, for example if your file system access is slow because it goes over the...
...or modification times, whereas your application could determine all this from your database. Introducing strace One option it to use strace for this, which logs all system calls performed by...
In my experience, the most common sources of memory leaks are APIs like these: addEventListener. This is the most common one. Call removeEventListener to clean it up. setTimeout / setInterval. If...
...you create a recurring timer (e.g. to run every 30 seconds), then you need to clean it up with clearTimeout or clearInterval. (setTimeout can leak if it’s used like...