Getting into PHP

I used to know a fair bit of PHP and could write simple WordPress plugins or basic pages. With the recent interest in Shortcuts, I started thinking it would be easier to do some of the little things I wanted to do with PHP on the web instead of using Shortcuts on my iPhone.

My first little project was a TTC Flexity Streetcar Delivery Tracker. The TTC is getting new streetcars from Bombardier on a regular basis, and myself and other transit users and fans like to track the arrival of new cars.

The TTC API, provided by NextBus provides some clues that a streetcar has arrived and is being tested or has entered service. Using the API, I’m grabbing data about an array of vehicles and then showing them in a table. That wasn’t too difficult to do for desktop, but getting it to look good on mobile was a bit tougher.

A few tutorials later, I got the media queries figured out and I’m showing the table rows as cards on my phone.

I’m really pleased with how this turned out and I’m already thinking ahead to my next little project. While there are a bunch of good apps like the Transit App that will tell you when your bus is coming, they are a little too complicated for Mac to use.

I’m going to make here a special webpage that will show her the next two buses home from Variety Village. It’s just the information she needs in a simple presentation.

Getting into Shortcuts

I’ve been playing around with the iOS app Shortcuts lately to see what types of things I can automate.

Shortcuts app is technically new as of iOS 12 but it’s been around for a few years as an app called Workflows that Apple acquired and integrated more deeply into the system.

I started by going through a tutorial on Apple’s website that took me through getting some data from a weather API and then doing something with it. I used the free OpenWeatherMap API and grabbed the current temperature for Toronto and had Siri speak it out loud.

That got me used to dealing with JSON API’s and also with how you hand data around inside Shortcuts to build more complex automations.

Next up, I decided to see if I could create a Shortcut that would tell me when the next bus was leaving the stop in front of Variety Village heading westbound towards our house.

I used the open Nextbus API and made a Shortcut that gets the time until the next bus is coming (five buses actually) and then speaks that out via Siri.

Once I’d perfected that Shortcut, I decided to try something a bit more complex. Often times the kids will come via transit to meet us in downtown Toronto. The Nextbus API also has an endpoint that provides the location of any vehicle by the vehicle number. I built a Shortcut that asks for the vehicle number, and then gets the latitude and longitude of that bus or streetcar and shows it in Apple Maps.

Limitless potential

I’m just getting started with Shortcuts. There’s so much you can do from grabbing public API data and manipulating it to taking text from one app and using the WordPress API to publish a blog post without ever opening a browser.

If you have an iPhone or iPad, check it out. There’s a lot of neat Shortcuts in the Gallery to get you started and show you what’s possible.

Back to the .com

After a time using a .blog domain with WordPress.com as my host, I decided to head back to my original jameskoole.com domain as my one-and-only domain and website.

The reasons are:

  1. WordPress announced that they aren’t going to provide a domain for free with their personal plans anymore.
  2. I didn’t have a great site up at my .com domain.
  3. My running blog is no more and was folded into this site anyways.
  4. I’m good at SEO now and have the 301 redirects in place to move all the search engine results over to jameskoole.com without issue.
  5. I want to get better at managing a server and doing things myself as I’ve fallen out of practice.

I opted to install WordPress on DigitalOcean in an Ubuntu droplet. That means some command line fun to get things like the Let’s Encrypt certs installed and renewed via cron. It’s pretty cheap to do it this way as the droplet is $5/month and it also gets me a server I can use for things other than the site.

Things went well with the move over (thanks WordPress for keeping data portability alive in an age of silos). Redirects are in place and I’ll be able to kill the .blog site and domain soon.

Priced out of Apple Stuff

Hey Tim,

Nice updates to the iPad Pro and that Mac mini looks pretty cool (finally). But can we talk about the price of this stuff? I literally can’t afford it and I’m pretty well off. Every single product you announced is hundreds of dollars more expensive than the products they replace. And in many cases, you kept the old one around at the same price as it was selling for yesterday.

That’s just crazy.