Well, since this is what people already do some of the time, they just do it manually, especially when learning a new language or library. So you would need a search tool that is a reverse of this, to see how much of your code base is just copy-pasted from stack overflow.