The curious case.

…of a mysterious bug that seems to resolve itself when you undo 5 minutes worth of code and redo all of it. Slowly. #

I get that I could have left accidental keyboard artifacts into the code that cause random syntax errors. But those are easy to identify. So then what?

I was writing some JS which involved Google Maps, HTML5 drag and drop and a few other things. Most of which I don’t have much experience with. I’m experimenting and making it up as I go. It was all working just fine until about 5 minutes ago. I turn around to talk to a colleague and turn back and as compulsive behaviour would have it, I hit Ctrl + R. Page refreshes and BLAM! Everything stops working. I double check code history, check git diffs, everything! Nothing had changed! WTF JAVASCRIPT!

I close-reopen the tab, restart chrome. Nothing.
I start undoing everything slowly. You know… undo, check, undo, check. Till I reach a point where its working. I start redoing the same way back. I reach the end of my redo history and guess what? Its working just fine. /cry /wrist

I think browsers like messing with you for the fun of it. Like a mysterious refresh counter which upon reaching a certain number just stops executing code. Those bastards from Chrome like messing with us.

(This was originally written a few months back. Don’t remember when. It was sitting in a text file which, unfortunately, I modified before I could see its last changed date.)


Now read this

Lesson of the day: Read more code.

Hahahahaha lmao wtf /die. :@ So, you should always read code. I know everyone says, “reading code is the best way to learn and improve your code” or something. But we are lazy. Stuff in code confuses us and we go back to watching House... Continue →