Most browsers have built-in drag and drop support for different page elements like text and images. While this may be useful in most situations, it may become annoying in...

...functionality. This does no longer work. You may now achieve this by explicitly preventing the startdrag-event:

const noDragElement = document.querySelector('no-drag-pls') noDragElement.addEventListener('dragstart', event => event.preventDefault())

...If you are plucking from the id column in particular you can also say: User.active.ids => [1, 5, 23, 42] For a DISTINCT selection, use distinct on your scope (not the...

...resulting array). Article.distinct.pluck(:state) # SELECT DISTINCT state FROM articles => ['draft', 'published'] In Rails 3 and 4 you must use uniq instead of distinct: Article.uniq.pluck(:state) # SELECT DISTINCT state FROM articles...

makandra dev
web.archive.org

When testing your command line application with Aruba, you might need to stub out other binaries you don't want to be invoked by your test. Aruba Doubles is a...

Install the gem as instructed by its README, then put this Before block somewhere into features/support: Before do ArubaDoubles::Double.setup prepend_environment_variable 'PATH', ArubaDoubles::Double.bindir + ':' end

github.com

The issue: You are using stub_const to change a constant value for your test. stub_const "SomeClass::CONST", 'test' All of a sudden, tests fail with undefined method 'some...

...method' for # . The reason When using stub_const before the Class containing the constant has been loaded, a module is automatically created with the name. Since RSpec does no autoloading...

...version understands? Did you double-check your @font-face declarations with all the hacky syntax that is required? Compare them with other declarations you find on the web.

...same name? This usually leads to trouble, but there are workarounds. Do IE's security settings prevent the download of webfonts? (see below) IE Security Settings can prevent font download...

In Rails, we usually have a mailer setup like this: class MyMailer < ActionMailer::Base def newsletter mail to: 'receiver@host.tld', from: 'sender@host.tld', subject: 'My mail' end end If you want to...

...Rails will print the mail's text representation to your log/development.log. You may also save this output as-is to an .eml file and open it with your mail client...

...optimize the experience. Using capistrano-rails capistrano-rails is a Gem that adds Rails specifics to Capistrano, i.e. support for Bundler, assets, and migrations. While it is designed for Asset...

...Pipeline (Sprockets) assets, it can easily be configured for Webpacker. This brings these features to the Webpacker world: Automatic removal of expired assets Manifest backups # config/deploy.rb # No need to include...

...in "Comment" with: """ This is a long comment. With multiple lines. And paragraphs. """ The step definition is part of the spreewald gem

Some users might use Adblock Plus or similar browser plugins to reduce the number of ads displayed. If you run into an issue that your application or part of an...

...our web apps. But if your application uses iframes or is embedded in another site it's more prone to it. Blocked elements most of the time appear to the...

...not possible to use variables in media queries with plain CSS. @media (max-width: var(--some-pixel-size)) {...

...} /* Does not work */ Postcss Plugin If you're using PostCSS to postprocess...

...your CSS, you can configure postcss-custom-media and add this feature: @custom-media --small-variable-name(max-width: 968px); @media (--small-variable-name) {...

...} /* works...

...Layouts tab you have handy options to debug CSS Flexbox and Grid. Including: Display size and lines along with labels Changing their attributes Change how overlay is colored and fastly...

...switch nested elements in the Elements panel This guide will only cover some example gif recordings on how to use with Grid, since it's basically straight forward to apply...

...don't only have a favicon.ico in your project but also PNGs of different sizes and backgrounds, you should test if all those files are actually reachable.

...few selectors to get you started: 'link[rel~="icon"]' # regular ones, matches "shortcut icon" and "icon" 'link[rel="apple-touch-icon"]' # iOS 'meta[content][name="msapplication-TileImage"]' # IE11 'meta[content...

...a remote API, check out the VCR gem as an alternative to Webmock or stubbing hell. The idea behind VCR is that is performs real HTTP requests and logs the...

...in a .yml file. When you run the test again, requests and responses are stubbed from the log and the test can run offline. It's a great way to...

In Cucumber, scenario outlines help avoiding tests that are basically the same, except for a few variables (such as different inputs). So far, nothing new. The problem

...your test should (or should not) do something, like filling in a field only for some tests? Scenario Outline: ... When I open the form And I fill in "Name" with...

...modern JavaScript down to EcmaScript 5. Depending on what browser a project needs to support, the final Webpack output needs to be different. E.g. when we need to support IE11...

...JavaScript features. Hence our output will be more verbose than when we only need support modern browsers. Rails 5.1+ projects often use Webpacker to preconfigure the Webpack pipeline for us...

...some beyond 50MB. Unless you need to offer this large files, you should always shrink uploaded files to a reasonable resolution. class ImageUploader < CarrierWave::Uploader::Base process resize_to_limit...

makandra dev

...to do it. Make an educated decision: Is the code change worth the effort? Stay straight on track, don't go astray. Note: Usually, you'd refactor after finishing your...

...story. At times, it might be necessary to refactor up front. But try to keep refactoring out of your current task. Knowing where to optimize Things should only be optimized...

makandra dev

I recently did a quick research on how to better write down multiline statements like this: # Dockerfile RUN export DEBIAN_FRONTEND=noninteractive \ && apt-get update \ && apt-get dist-upgrade -y...

...apt-get install --no-install-recommends --no-install-suggests -y \ ca-certificates \ curl \ unzip It turns out, there is! Buildkit, the tool behind docker build added support for heredoc strings...

github.com

...GitHub repository is a bit like our "dev" cards deck, but groomed from a single person (Josh Branchaud). It includes an extensive list of over 900 TILs on many topics...

...TILs that were new to me. I encourage you to take your time to skim over the original list as well! Assoc For Hashes Hash#assoc can be used to...

developer.mozilla.org

Container queries enable you to apply styles to an element based on the size of the element's container. If, for example, a container has less space available in the...

...surrounding context, you can hide certain elements or use smaller fonts. Container queries are an alternative to media queries, which apply styles to elements based on viewport size or other...

...a web developer, you know Google Analytics (GA). Probably you've dropped the GA snippet into more than one website, maybe you've even used its Javascript API to implement...

...configurable without changing anything in the application's code base (and much more beyond, see below). Only prefer GTM if the customer requests it, or if he is updating his...

To update your Rubygems to the latest available version, type the following: gem update --system Note that you have a separate Rubygems installation for each Ruby version in your RVM...

...or rbenv setup. Updating one does not update the others. Ruby 1.8.7 If you are using Ruby 1.8.7 you cannot use the latest version of Rubygems. Type the following to...

...messages should include the ID of the issue your code belongs to. Our preferred syntax prefixes the issue title with its ID in brackets, e.g. [FOO-123] Avatars for users...

Fresh Chrome installations now show a "Choose your search engine" popup in Europe. This might make your Cucumber tests fail. Fortunately there is a flag to disable the popup. Add...

...the following option to your chromedriver setup code: options.add_argument('--disable-search-engine-choice-screen') I found this flag in Peter Beverloo's list. Background: This was experienced locally with...