In programming, which spelling—adapter or adaptor—is standard or de facto standard? Is there a difference between them?
In boost I see "adaptor", whereas in literature I see "adapter".
Which one is preferred in code?
They are both correct, though I think there's a slight preference for adapter to be used for people (such as someone who adapts a piece of music), while adaptor is used for a device or machine; thus, in computing, adaptor would generally be used. Wikipedia mentions this distinction, though without any real references to back it up. I would use whichever you feel more comfortable with, or the one in already in use in the code base you're working in if the word has been used already.