Make control-h backspace in TextMate

In macOS, ^h (AKA control + h or ctrl h) will usually delete backward one character, i.e. do the same thing as backspace or what Apple labels delete on its keyboards. Therefore it’s somewhat disconcerting that ^h in TextMate runs “Documentation for Word” or similar “Documentation for Current Word” actions.

Here’s how to disable the default control-h behaviour in TextMate 2.0, and get backspace behaviour instead.

From the menu bar, click Bundles > Select Bundle Item.

screenshot of TextMate Select Bundle Item dialog

From the gear menu in the “Select Bundle Item” dialog, select “Key Equivalent”.

TextMate Select Bundle Item dialog searching for ^h key equivalent

In the search box, press ^h.

Then for each of the matching documentation actions (there may be several from different bundles), click “edit” then clear the “Key equivalent” field in the side drawer. Close the bundles window and save.

screenshot of the TextMate bundle editor

Repeat the previous step for any other bundles that define a documentation action for ^h.

WordPress GCS plugin broken thumbnails

The GCS plugin for WordPress lets you use Google Cloud Storage for WordPress’s media and other uploads. This is required on stateless environments like App Engine, where there’s no persistent writable filesystem to store uploads.

However, image thumbnailing and rescaling is broken by default when using the plugin, so while you can upload an image, the thumbnails that usually get automatically generated will never appear in the GCS bucket. So if you add high-resolution images to a post, load times will be massively increased, which is a particularly bad experience for low-resolution mobile devices.

I raised a WordPress ticket and attached a patch that fixes the issue. The patch needs to be applied to the core WordPress installation (rather than being a plugin), so may not be an option for WordPress admins that are using multisite hosting. I think a plugin-based fix would be possible (one that replaced the default image editor with a fixed one), but would involve duplicating a bunch of code from core WordPress.

Continue reading “WordPress GCS plugin broken thumbnails”

Costs of running WordPress using Google Cloud

Self-hosting a WordPress blog gives you the ultimate control over your website and database. However, you may want to utilize cloud IaaS or PaaS offerings to provide the lower-level infrastructure (machines, network, or even the webserver). Google provides resources for running WordPress on Google Cloud Platform, but there is very little upfront information about the costs of the different options. GCP’s complex pricing (with Always Free quota and sustained-use discounts), along with some hidden costs in some configurations, made it difficult to predict the final monthly cost.

Knowing the price of hosting a WordPress blog on Google Cloud Platform is important, because small-time bloggers are going to be comparing these options against options that cost less $5 a month or even nothing (e.g. the WordPress.com personal and free plans, or even jumping blogging platform completely to Medium or similar).

I’ve recently been through the exercise of measuring the costs of running WordPress on GCP with this blog. The summary of the dominant costs is:

Configuration Breakdown Minimum Cost (USD) per month
App Engine + Cloud SQL
(asia-east2)
f1-micro App Engine instance ($0) +
db-f1-micro MySQL Cloud SQL instance ($11.50) +
10GB-months low-cost storage ($1.35)
$12.35
App Engine + GCE + VPC
(asia-east2)
f1-micro App Engine instance ($0) +
f1-micro GCE instance ($5.42) +
2x f1-micro VPC Connector ($10.84) + PD ($1.45)
$17.71
App Engine + exposed GCE
(asia-east2)
1 f1-micro App Engine instance ($0) +
f1-micro GCE instance ($5.42) +
PD ($1.45)
$6.87
Just GCE
(asia-east2)
f1-micro GCE instance ($5.42) + PD ($1.45) $6.87
free App Engine + free GCE
(us-central1)
f1-micro App Engine instance ($0) +
f1-micro Always Free GCE instance ($0)
almost $0

Caveats:

  • $0 prices assume you’re not already consuming your GCP “Always Free” quota.
  • There are some additional costs not included in the table (storage and network), but they were < $0.10/month for me.
  • I’m not counting Google’s $300 “free trial”, which only lasts 12 months.

Continue reading “Costs of running WordPress using Google Cloud”