Make it an Irish coffee and you'll get there faster. My sweet spot was ~3 beers in an hour and I could suddenly code better (and it wasn't the alcohol talking).
There's something similar with cannabis as well. Just a buzz and I'm a laser, even slightly more and suddenly I can't remember the process I was working on.
It's like looking through a telescope. Everything within the lens is clear and detailed, but anything on the periphery might as well not exist. Very useful state of mind for certain coding tasks.