Update regex to allow for new sha-ish ids in Gist.

Recently Gist unified all the URLs (which in public gists were numeric
and in private gists, alphanumeric). This made certain flows break but
Gist now should redirect to the proper url if given either the new
SHA-ish id or the classic numeric ID.

This PR also resets some of the assumptions in the test suite to better
match the current implementation of Gist.