The home improvement retailer beat Wall Street estimates in its second quarter as its customers continued to take up smaller projects.