Did you know that there is no way to spell WordPress incorrectly, in WordPress? Even if you don't upper-case the "P" in "Wordpress,"
WordPress will still auto-correct it upon content save. That means you can't even have a post on your own site to talk about this "feature" and quote the actual misspelling.

We can thank this function.

Desktop Notification When Command Finished (MacOS)

If you have some one-off command you’re running a lot and it takes a long time to complete, you can use the native notification system in MacOS via command-line Applescript access to send yourself a notification once the command is done:

osascript -e 'display notification "DONE" with title "Command Done"'

I setup a bash alias so I can easily append this whenever I need:

alias notify_me="osascript -e 'display notification \"DONE\" with title \"Command Done\"'"

And then…

What Was Ruby Compiled With?

If you ever need to see the compile-time options for Ruby (–configure input), use this command:

$ ruby -rrbconfig -e "puts RbConfig::CONFIG['configure_args']"
 '--prefix=/Users/graham/.rbenv/versions/2.3.1' '--with-openssl-dir=/usr/local/opt/openssl' '--with-readline-dir=/usr/local/opt/readline' 'CC=clang' 'CFLAGS= -O3 -Wno-error=shorten-64-to-32 ' 'LDFLAGS=-L/Users/graham/.rbenv/versions/2.3.1/lib ' 'CPPFLAGS=-I/Users/graham/.rbenv/versions/2.3.1/include '


Selenium Browser Testing & Full Page Screenshots

If you require full-page screenshots in Selenium, save yourself some time and use the following:

  • Firefox 47.0.1
  • Latest version of selenium-webdriver Ruby Gem (I am on 3.0.7)

This should be the only code you need:

caps = Selenium::WebDriver::Remote::Capabilities.firefox(marionette: false)

driver = Selenium::WebDriver.for(:firefox, desired_capabilities: caps)
driver.get ''
driver.save_screenshot 'screenshot.png'

Version combinations matter a lot because the underlying automation driver has gone through a lot of changes, specifically for Firefox. Firefox has a new automation driver called Marionette, but it’s very new and not widely supported. In Selenium 3.x, Marionette defaults to off and uses the legacy driver.

Most browsers are now following the W3C standard, which means screenshots will be of the view port, not the entire full rendered page. This isn’t super helpful if you want to capture a long page and the footer content is needed.

You can read more on the Selenium issue about why this doesn’t work in some version combinations.

If you want to use Chrome, good luck. There has been an open bug report for Chrome for years about this without a fix. Given how a lot of people have moved on to taking screenshots, scrolling the page, then stitching images together, it doesn’t seem likely this will be natively possible anytime soon. The screenshot-scroll-stitch method isn’t very useful if you have header content that stays stuck to the top of the screen.

If you are using this kind of setup with Capybara on top, you’ll likely run into even more problems. Capybara doesn’t appear to fully support Marionette yet, so you may need to downgrade and lock versions to get everything working correctly.