This actually reminds me of a book called "The Ecstacy Club". I recommend everyone read it, of course. The relevant part is one of the characters was brainwashed so that, upon receiving a stimulus (seeing a certain number, IIRC), he would forget the last few hours or so.

Being a programmer, the guy started using this to help him develop code: whenever he couldn't find a bug he'd flash himself so he could have a fresh look at it. ;)