Capybara will match elements outside of a page's tag. For example, the step definitions below match nodes in a page's : Then /^my browser should auto-discover the "([^"]*)" feed...

page.should have_css( 'head link' + '[rel="alternate"]' + "[href='http://www.example.com/#{slug}/feed.rss']" + '[title="RSS feed (all cards)"]' + '[type="application/rss+xml"]', visible: false ) end Then /^my browser should...

When you create e.g. a sidebar box that contains headlines and paragraphs, the final paragraph's margin in that box will create an undesired 'bottom padding' inside that box.

...is a Sass mixin that you can apply to such boxes. It makes the last child's bottom margin disappear: =hide_last_margin >*:last-child margin-bottom: 0

...default Ruby, RubyMine will give you incorrect inspections, for example.\ Here is how to switch which Ruby you use in RubyMine. File → Settings (Or press Ctrl+Alt+S)

...SDK and Gems" from the left pane Switch your "Ruby interpreter". Though it may seem you are changing a global setting here, this is in fact a per-project setting...

find . -cnewer other_file This can be used to check against a specific timestamp, too. This is how you check for all files modified today (since...

...the current bash's PID so you will get some file like /tmp/12345 that stays the same for the current shell. This allows you to check against this file again...

...you want to manually check if e-mail delivery works on a machine by sending an e-mail you can run the following: mail -s Test someone@example.com < /dev/null

...send an empty e-mail with "Test" as its subject to someone@example.com. If you want it to contain a message body, call mail -s Test someone@example.com only; the mail application...

makandra dev

...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...

askubuntu.com

Adobe no longer supports their PDF reader on Linux and the official page does not offer it for download. \ However, some files may not display properly on Ubuntu's default...

...PDF reader Evince or PDF forms may not work as expected. Hence, you may still need to use it. Here is how to install the Adobe Reader (acroread) if you...

Note that we used $ and ^ to explicitly look at the end and start of the filenames...

...git pull won't know its remote version. You could use difficult commands to set up a branch's tracking but it's easier to...

...just push it like this: git push -u From the documentation on git push: -u, --set-upstream For every branch that is up to date or successfully pushed, add upstream...

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...

makandra dev
tom.preston-werner.com

A perfect implementation of the wrong specification is worthless. By the same principle a beautifully crafted library with no documentation is also damn near worthless. If your software solves the...

...wrong problem or nobody can figure out how to use it, there's something very bad going on. Fine. So how do we solve this problem? It's easier than...

pganalyze.com

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...

Here's a pretty useful steps that hasn't made it into Spreewald yet. It is best used with the auto-mapper for BEM classes in features/support/selectors.rb

...above [selector] element When /^I hover above (.*) element$/ do |selector| page.find(selector_for(selector)).hover end Example: When I hover above the album's image element → triggers a hover event...

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...

...binary, do not install Ubuntu's node package. Instead, you need to create a symlink that points to the binary one of the nodejs package: sudo ln -s /usr/bin/nodejs /usr/bin/node...

...You probably already installed NodeJS. In case you did not: sudo apt-get install nodejs If you already installed the node Ubuntu package, bower will just do nothing (i.e. not...

...disable hiding URL parameters, open up Tools → Preferences (Ctrl+F12) → Advanced → Browsing and check "Show full web address in address field". No need to touch opera:config. The badge that...

...displays the page's "zone" (Web, Secure, Opera, ...) will be shrinked so you can still see a yellow lock for proper SSL connections, etc...

ZSH is an alternative command line shell that includes some features like spelling correction, cd automation, better theme, and plugin support. You can replace Bash with ZSH like following:

...apt-get install zsh Setting ZSH as default login shell sudo usermod -s /usr/bin/zsh $(whoami) Opening a new terminal window will show you a dialog where you can configure your...

askubuntu.com

I was annoyed that RubyMine's autocompletion did not work via Ctrl+Space for me. In fact, it did not work in any application. Turns out that keyboard combination was...

...hijacked by Ubuntu as it's the default for switching input languages (i.e. keyboard layouts). If you use only 1 language/layout, you will not notice except for the key not...

makandra dev
ishadeed.com

Table Of Contents Flexbox wrapping Spacing Long content Prevent an image from being stretched or compressed Lock scroll chaining CSS variable fallback Using fixed width or height...

...The fixed height The fixed width Forgetting background-repeat Vertical media queries Using justify-content: space-between Text over images Be careful with fixed values in a CSS grid

You must reconfigure the guest so it will get its own IP address: Shutdown the guest In the guest's VirtualBox settings, choose Network and switch the network adapter type...

...Unix) or ipconfig (Windows) You can now connect to this IP address using HTTP, SSH, etc. Note that by doing this your VirtualBox guest is fully exposed on the local...

askubuntu.com

...not play nice with gnome-open. You can fix the problem by uninstalling it: sudo apt-get remove exo-utils Note that this may also uninstall XFCE tools like xfce4...

To reduce download time, application servers usually serve content using gzip compression, if the browser supports it. When using a tool like Wget to explicitly download an application's response...

...the server responds with the uncompressed version: wget http://example.com/ If you are curious about the compressed file's size, pass the corresponding HTTP header: wget --header="accept-encoding: gzip...

In rare cases you might need something like form_for (for using form builder methods on the resulting block element) but without the surrounding form. One such case would be...

...updating some of a form's fields via XHR. You can simply use Rails' fields_for to do things like this in your views (HAML here): - fields_for @user do...

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...