I don't much feel like coding when I'm stoned. Classifications for cannabis are still somewhat unreliable due to its history with prohibition, but I usually lean more towards the "Indica" label because I generally consume cannabis in the evening before bed (and I don't believe I am always capable of being "competent"/reliable stoned). For those that don't partake or haven't looked into it, Indica is believed to make you relaxed or tired, and Sativa is believed to make you energetic and creative.
I have had limited experiences with Sativa's, but generally I just find them more potent and less forgiving. It's easier to get "too" stoned on cannabis labelled Sativa in my experience. To reiterate, I generally am not motivated to code stoned, and I have very limited experience with it.
I vaguely recall (cannabis use also cripples short term memory, particularly while stoned) that I attempted it once, and I think I found it very difficult (i.e., things that I would normally do sober without any trouble became very difficult to track/figure out).
One anecdote that I can provide is that several of my [ex-]colleagues were apparently stoned during work, and if that is any indication of its effects on the quality of output then it should be avoided at all costs.
Finally, if this code is truly so amazing then I suggest you post a snippet of it for us to analyze. When I'm stoned I often think I'm having brilliant ideas, but typically when I share them with sober people they roll their eyes. There's no doubt that cannabis has inspired a lot of good ideas, but I think what gets a lot less attention is how many bad ideas it generates too.
My experience has been that cannabis really just intensifies the creative center of your brain. You don't necessarily have better ideas, but you have a higher frequency of ideas. Just like normal some of those ideas are good, and some of those ideas are bad. If you can manage to identify the good ideas then you can benefit from them. The downside is that you are generating so many ideas, and your short term memory capacity is compromised, so it can be very difficult to remember your ideas. I'm often in the middle of telling somebody my "genius" idea when it just *blanks* on me and I can't remember for the life of me what I was even talking about.
For this reason, if you are attempting to generate good ideas with cannabis I recommend a convenient, simple, and fast tool to help you record as much detail about the idea as quickly as possible because odds are you will lose it shortly. Maybe, just maybe, if you recall the log(s) you'll discover some worthwhile ideas that might not have occurred to you sober.
My ideas seem to only last a matter of seconds. Maybe 7 or 10 seconds before I lose them. Sometimes I might last 30 seconds or a minute, but it's rare for me to be able to hold onto an idea longer than that without at least recording it somewhere (other than my own short term memory) to recall.
tl;dr Cannabis is a lot of fun, and has some beneficial medicinal uses too, but it's probably not going to make you awesome at anything that you aren't already awesome at (but you might get lucky on occasion).
I wish I was stoned right now, but I have a bad cold coupled with a bad sore throat, and I'm worried vaping is going to exacerbate it (and/or caused it). I am all out of capsules. I was supposed to have a fresh order delivered today, but the postal worker apparently didn't do his job.