Always-on/always-on-you devices provide three powerful fantasies: that we will always be heard; that we can put our attention wherever we want it to be; and that we never have to be alone.

Sherry Turkle

Resetting Your Github Fork

Let’s say I want to contribute to a project on github. The project repository is at wp-cli/wp-cli. First I fork it, and then clone the resulting repository, scribu/wp-cli:

git clone --recursive git@github.com:scribu/wp-cli.git
cd wp-cli

Now, I make some commits to master, push them to my fork and open a pull request. Piece of cake:

git commit -m "awesome new feature"
git push

But, what happens if my pull request is rejected or only certain commits are accepted? I’m left with a dirty master branch. Oh noes!

There are two ways of solving this:

A. Delete my fork and create it again via the github interface. Can’t get any easier than that.

B. Use git reset:

git remote add upstream git://github.com/wp-cli/wp-cli.git
git fetch upstream
git branch backup
git reset --hard upstream/master
git push --force

If I made a mistake, I can rescue my commits by calling git checkout backup.

Management Style

In 2004, Linus Torvalds wrote a characteristically honest guide on how to handle technical decisions for the Linux Kernel.

Just replace “kernel manager” with “bug gardener” and you’ve got a nice handbook on how to manage WordPress tickets and patches.

Github Tricks

What I’m about to show you are functionalities that I’ve actually needed at one point or another, but which aren’t featured proeminently in the github interface.

In both cases, start at a repository’s home page. For example:

https://github.com/andreascreten/wp-cli

See commits from a certain user

  1. Click the Stats & Graphs button.
  2. Click the Contributors tab.
  3. Click the name of the contributor you’re interested in.

You’ll end up with an URL like this:

https://github.com/andreascreten/wp-cli/commits/master?author=scribu

See issues assigned to a certain user

In Github Issues, it’s really easy to see tickets assigned to yourself, but no apparent way to view tickets assigned to others. There is a method, but it’s rather convoluted:

  1. Click the Issues button.
  2. Do a random search using the Issues & Milestones search box.
  3. Select “Assigned to” user from the dropdown on the left.

The final URL will be:

https://github.com/andreascreten/wp-cli/issues?assignee=andreascreten&state=all

For more hidden gems, see GitHub Secrets.

The joke is actually a jump from one context to another. [...] All creativity is an extended form of a joke.

Alan Kay

In software systems, it is often the early bird that makes the worm.

Alan Perlis

On Building UI

03:23 <Jane__> general ui advice (everyone listen): on your first round take out as much ui as you can without thinking you’re looking at a cheese sandwich. test it. find the bits that confuse everyone, and then add ui for those things. don’t start with ui for everything. people are clever and use the web. they will figure things out, and the things we think they’ll get are always the wrong ones

When economists base their models on their fantasies of an “economic man” motivated only by self-interest, they forget community – the all-important web of meaning we spin around each other – the inescapable context within which anything truly human has taken place

Christopher Ryan and Cacilda Jetha

Easier way to update submodules in git

I love using git submodules to avoid duplicating common code. Unfortunately, updating a submodule reference to the lastest revision is a chore:

cd framework
git checkout master
git pull
git submodule update --init --recursive
cd ..

However, we can store all of those commands using a git alias:

git config --global alias.up-sub '!f() { cd $1 && git checkout master && git pull && git submodule update --init --recursive; }; f'

Now, to update the ‘framework’ submodule, we can just do:

git up-sub framework

I picked up the trick for running multiple commands in an alias from this article on the Mozilla blog.

Update Use && instead of ; to prevent losing work when you mistype the submodule name.

Lisp and Vim

What makes Lisp special is that executable code has the same syntax as data structures.

What makes Vim special is that the mode for entering text uses the same keys as the mode for executing commands.

Both Lisp and Vim have very powerful macro systems.

Both Lisp and Vim rock my socks off.