Following months of reports that advertisers have been abandoning Twitter, the microblogging platform surprised yesterday with better-than-expected earnings and advertising revenue, sending its shares higher in after-hours trading.