He didn't "crack the code", he made dangerous, stupid promises, got elected by dangerous, stupid people, and then fulfilled most of them. Things like renegotiating NAFTA, dropping more bombs on ISIS, taking a hammer to NATO, trying to ban Muslims, giving Russia lots of concessions for deals on "terrorism", all of these were easy to do but bad for the world.