Dev log
Git stash: how to save work and switch branches
git stash -u saves your uncommitted changes, including new files, and gives you a clean working tree. git stash pop brings them back.
4 min read
Dev log
Dev
Technical notes on WordPress, Shopify, PHP, JavaScript and the other tools I build with every day.
Dev log
Git stash: how to save work and switch branches
git stash -u saves your uncommitted changes, including new files, and gives you a clean working tree. git stash pop brings them back.
4 min read
Dev log
Git cherry-pick: copy a commit to another branch
Switch to the branch that needs the change, find the commit hash, and run git cherry-pick . Git copies that one commit and merges nothing else.
4 min read
Dev log
Compile Sass (SCSS) with PHP using scssphp
Compile SCSS to CSS from PHP with scssphp. Install it with Composer, compile a file, pass in variables, cache the result, and know when I'd use Dart Sass.
4 min read
Dev log
Manage WordPress with Composer
Install WordPress plugins and themes with Composer. I cover composer/installers, WPackagist, installer paths, autoloading your own code, and what to commit.
4 min read
Dev log
Run WordPress across local, staging and live environments
One codebase, three environments. I cover per-environment settings in wp-config.php, WP_ENVIRONMENT_TYPE, keeping secrets out of Git, and moving content.
4 min read
Dev log
Create a custom log function in PHP
A small PHP function that writes timestamped messages and arrays to a log file you choose. Plus where I keep that file, and what never to log.
4 min read
Dev log
Password-protect a folder with .htaccess and .htpasswd
Put a username and password on any folder with Apache basic auth. Create the .htpasswd file with bcrypt, add four lines to .htaccess, or use the Nginx version.
3 min read
Dev log
Magento & WordPress password hash generator
Make a password hash for WordPress (bcrypt, phpass or MD5) or Magento 1 and 2, and set it in the database when you're locked out. Or use WP-CLI or bin/magento.
4 min read
Dev log
Migrate a WordPress site from local to live
Move a WordPress site from your computer to a live server. Copy the files, move the database, fix URLs safely (serialized data included) and check everything.
4 min read
Dev log
Redirect logged-out users in PHP and WordPress
Send visitors who are not signed in to the login page. A safe session check in plain PHP, and the WordPress way with is_user_logged_in() and auth_redirect().
3 min read