Composer install suggestions

With Craft CMS 3 Beta, there's a fair amount of packages to install via Composer, there's also a sizeable list of suggested packages (mostly for use with sources). Usually I'd just include whichever suggestions I'd want to install by copying and pasting each package into a `composer require X`, but there's a quicker way to go from suggestion to require; the following line will add a ll suggested packages as a requirement to your Composer project.

composer suggests | xargs -i composer require {}

This may be overkill for some (most?) projects but for Craft CMS 3, I want to ensure these packages are available should a user or plugin later require it, or if a suggested package is just more efficient! Like the `ext-gmagick` package for use with P&T's Imagine editor.

Open Google Chrome in Kiosk Mode on Mac

set strUrl to ""
do shell script "/Applications/Google\\\\ Chrome --app=" & strUrl tell application "Google Chrome" to activate
tell application "System Events"
keystroke "f" using {command down, control down}
end tell

Remove all .DS_Store files

.DS_Store  files aren't much of a problem to your Mac, these small files provide information about how you want to see the directory laid out, the position of icons within the folder. However, if they disturb your chi you can remove them recursively from /  using the following command:

sudo find / -name ".DS_Store" -depth -exec rm {} \;

These files will of course be regenerated whenever you enter a directory without one via Finder.

Rebuild Spotlight Index on Mac OS X

Sometimes after several months Spotlight doesn't work very efficiently and starts to slow down your Mac. Fortunately there's a way to reset the Spotlight Index so that it reindexes your drives which may also lead to a smaller index file size.

Just open Terminal via Spotlight or go to Applications > Utilities > Terminal and copy in the following:

sudo mdutil -E /

This will clear everything from Spotlight and the reindex will start immediately.

If you're having problems (or suspect you're having problems) with a particular drive you can reindex only that drive by using the following command:

sudo mdutil -E /Volumes/[DriveName]

Just replace [DriveName] with the actual path or omit the path; drag and drop the drive from Finder to insert it.

You can exclude drives from Spotlight by going to System Preferences > Spotlight > Privacy.

SourceGuardian - The Zend Engine API is outdated

The following error occurred on CentOS 6 with cPanel 11.48.4 when using the CLI version of PHP:

SourceGuardian requires Zend Engine API version 220131226. The Zend Engine API version 220121212 which is installed, is outdated.

Googling for a way to safely update Zend Engine API resulted in 3+ year old threads with no answers or clues on how to update with WHM installed.

If you're looking to update the Zend Engine API, then this guide is not for you. Instead, I chose to remove Zend from the CLI PHP config as the error message being displayed on all PHP crons was breaking the scripts.

Here's how to remove Zend from your PHP CLI config...

First, find the config file for the CLI PHP. You can do this by checking your existing config file using php -i – use grep to grab the path with php -i | grep 'Configuration File' .

For me php.ini was located at /usr/local/lib/php.ini

Find the line zend_extension = "/usr/local/sourceguard/ixed.x.x.lin" and comment it out. Restart Apache and you should notice that the error no longer displays. I'm not entirely sure what the Zend Engine is for under CLI PHP but I haven't encountered any issues yet.

If you encounter issues, just uncomment the line and restart Apache. Following these instructions should be a last resort if you cannot update Zend Engine API, so you do so at your own risk.

Recursive chmod only on directories

Run find on -type d (directories) with the -exec primary to perform the chmod only on folders:

find /your/path/here -type d -exec chmod o+x {} \;

To be sure it only performs it on desired objects, you can run just find /your/path/here -type d first; it will simply print out the directories it finds.