Why I hate WordPress but used it anyway for this blog

· Workflow · Patrick Smith
  1. It gets me writing,
  2. And not wrangling with code.
  3. I get online editing, drafts, Ulysses integration out of the box.
  4. I can make edits and publish from my phone.
  5. My readers get RSS out of the box.
  6. The default 2019 theme looks decent.
  7. It brings categories, pagination, some decent plugins (and some hacky ones).
  8. It renders on the server instead of the client, bringing better SEO.
  9. It doesn’t use service workers which I think applied naively is premature optimisation and a worse user experience.

Handy Makefile Rules and Patterns

· Workflow · Patrick Smith

Patterns

Required variable

$(or $(build),$(error Must set build variable))

Optional variable with fallback

$(or $(branch),master)

Git

Rebase on origin’s master

rebase_origin_master:
	git pull --rebase origin master

Create a git commit message template with co-authored-by set

# Requires card=…, name=…, and a contributors.txt file
pair:
	@echo "$(card) \n\nCo-authored-by: $(shell grep -i $(name) contributors.txt)" > .git/.gitmessage
	@git config commit.template .git/.gitmessage
	@cat .git/.gitmessage

Rails

Run the most recently modified spec

recent_spec:
	bundle exec rspec $(or $(shell find ./spec -name "*_spec.rb" -cmin -5 -exec ls -1tr "{}" + | tail -n 1),$(error No *_spec.rb file modified recently))

Run specs with changes not yet committed

uncommitted_specs:
	bundle exec rspec $(shell git status --porcelain | grep -E "^[^D][^D] .+_spec.rb$" | cut -c4-)