A blog probably of interest only to nerds by John Morton.


A Checklist When Transitioning from MAMP to Valet

I have used MAMP for local development for a long time. Several people I know through the Craft CMS Slack group have professed the benefits of Laravel Valet so I decided to give it a spin as an alternative to MAMP. When it comes to Craft CMS there is a built-in driver that allows Valet to serve a Craft site without any additional configuration. You just place your Craft site in... + read on

Extracting a YouTube ID from a URL with Twig

I had a client who wanted to embed YouTube videos in their Craft CMS site. It would have been easiest for me to have them only include the YouTube video ID but the sharing box on YouTube gives you a full YouTube URL. You can see that URL in the image at the beginning of this post. I didn’t want to add any plug-ins to my Craft CMS site to do this so I decided... + read on

Detecting and debugging the Instagram in-app browser

I had to debug an issue with a site I built when client/friend discovered that the menu toggle icon disappeared only when visiting her site from within Instagram, specifically, on her bio page where she has a link to her site. Being an in-app browser within an application I have no control of, I struggled to debug this problem. The "userAgent" string, as shown in the image above helped me out. I used the following... + read on

How to re-add Github key to a server

Note to self: Don’t erase your knownhosts file. (headslap!) I provision servers with Laravel Forge and messed up my deployment from Github recently. I was messing around in the .ssh folder on my server and deleted the known_hosts file. The next time I tried to deploy my code base from Github though, I got the following error. Host key verification failed. fatal: Could not read from remote repository. I needed to get my server to... + read on

Craft CMS: A bigger “Plain Text” field.

I inherited a Craft CMS site that I now maintain for a new client. When you inherit other people’s code, you need to see the project from their POV to get an understanding of they see things working. Luckily Craft seems to encourage logical structures being built so I’ve not had too much trouble getting up to speed on this site. One of the problems I did run into was with a simple Plain Text... + read on

How to use HandBrake's queue feature to convert multiple videos.

You like videos, right? Then you’re probably familiar with HandBrake, the open source video conversion tool. Encoding a single file is pretty straightforward, but the program has the ability to set up a cue and go through a bunch of shows while you are away from your computer. Here’s a quick video walkthrough on how to use this feature I put together for a friend. ... + read on

Tutorial: Using Gulp with htmlprocess and concatenate

I’ve been teaching myself Gulp recently. I found the basics easy to pick up. Although I didn’t consider myself a Grunt expert, I’d taught myself Grunt previously and that helped with me with Gulp. Before we go further, check out the GitHub repository that contains the finished example project we’ll go over here: https://github.com/johnfmorton/using-gulp-htmlprocess-example One thing I have seen in both Grunt and Gulp workflows I’ve used from their repositories was a... + read on

Automate daily database backups with crontab and SFTP and be the master your domain.

I recently worked on a site which saved data in it’s local database which needed to be collected and sent each day to a remote server via SFTP for analysis. Needless to say, I didn’t want to manually do this process every day, but I had never fully explored cron jobs, so I had to teach myself about cron jobs while I figured out the problem at hand. Here’s how I ended up automating the... + read on

Google Analytics, Ghostery, and Event Tracking

At the time I write this post, Google Analytics has a new version in beta called “Universal Analytics”. It’s basically Google Analytics version 3. This means that code you may have relied on during the version 2 of Google analytics may no longer work. Google suggests that all new projects moved to version 3 now. It does offer “real time” analytics, so you can see who is on your site at that very moment. That’s... + read on

Use a cookie to iterate between visits with PHP.

Here’s a small code snippet that I use to increment a value between visits using a PHP cookie. I use it, for example, when I have 3 different images that could go on a page, and I want to serve up the next one in the sequence on subsequent visits to the page. I just use the "$num" where appropriate. You can edit the ‘2’ in line 14 to change the wrap around value to... + read on