I can code on ketamine as long as I'm not doing anything novel nor dealing with something that requires a global, holistic view of a system and its interactions. Once you've done something for long enough it becomes subconscious, so as long as I'm still able to type code in and see what I've typed (to correct all the mistakes lol) it's possible to program while under the influence.