Maybe I'm misreading the source, but it seems as though this solution will not work if both caching and gzip are enabled. Again, if I understand it correctly, the asset URL is being dynamically generated based on whether or not the client supports gzip, by adding (or not) a base directory to the asset request. So, if your first visitor does not support gzip, then the page will be be cached with gzip disabled, and no subsequent traffic will receive the gzipped version of the assets, or vice-versa for compressed content.
That's true. In reality however, all modern browsers support gzipped content so the chance of caching gzip-disabled pages is pretty low.