I hear ya there. There have been times I've been coding a project and had an issue come up that made no sense at all and the fix made even less sense. Used to joke and call it "voodoo coding".
if "condition A" = true and "condition B" = false; "condition C" = true;
elseif "Stand on one foot, hop 3 times, then spin around while spitting over your left shoulder" = true; then "condition C" = false;