Install PHPUnit for PHP 5.6 and PHP 7.1 on Homebrew

So you found this post because you just updated or installed PHPUnit, you're running PHP 5.6, and you get this error:

"This version of PHPUnit is supported on PHP 7.0 and PHP 7.1.
You are using PHP 5.6.30 (/usr/local/Cellar/php56/5.6.30_6/bin/php)."

Maybe, like me, you're cranky about virtualization and you're using a PHP switcher to switch between PHP 5.6 and 7.1.

The solution?
brew install [email protected]

Responsive iframe in Drupal 8 from Client Embed Code

Nobody likes iframes. That's because you can't style their innards, and they aren't responsive... or are they?!?!

The first thing to know about here is the padding height hack. This allows you to set the height of an object relative to the width, because while height is always as a percentage of the container, padding height is as a percentage of width. So all you have to know is the ratio of height to width and you can make a thing that responsively scales.

.gitignore by branch

Have you ever wanted to .gitignore a file by branch?

The classic example for me here is versioning the generated styles.css file on master (which is deployed to production) but not on develop (which is used for pull requests).

Versioning the styles.css file can result in merge conflicts or PRs that are just messy.

Here's the script I wrote.

Read the comments for installation notes.

Add Drupal 7 Flag/Unflag Links to View for All Available Actions

The view relationship for Flag module only allows you to set a single flag type as a target, which means only one flag type is available on a views row.

My specific use case is adding flag/unflag links to the /admin/content page which I've replaced by a view with the Admin Views module. I ended up digging around quite a bit through Flag module's source code to pop this one out.

PDF to PDF OCR launchd Daemon: Setting a Watched Folder to Create OCR'ed, Searchable PDFs on Mac OSX

The landscape of paid OCR solutions is, well, expensive. And the unbiased folks from the tesseract homepage say, "Tesseract is probably the most accurate open source OCR engine available." Tesseract OCR's images, but pypdfocr uses tesseract as an engine to convert whole PDFs.