Code samples at an interview are a dangerous prospect because, as suslik said, you probably don't own the code. If you wrote it for an employer, regardless of how general-purpose that code is, it's your employer's IP, which you were paid your salary to produce for them.
It also doesn't have to be yours. Numerous blogs, QA sites (like the SE family) and other sources for "t3h fr33 c0dez" abound. Coding languages, in general, have fewer ways to say what you need to say, and combined with "best practices" and refactoring assistants, two knowledgeable coders' implementations of a QuickSort algorithm could differ only cosmetically (and cosmetic changes are the easiest to make to somehting you sneak off the interwebz).
In addition, I dunno about the rest of the development world, but code I write "on my own time" is typically not code I'd like to show off. That code is stuff I create for my own enjoyment, usually without a huge amount of attention paid to architecture or documentation, because it's code that's only "right" (not only correct but well-organized and well-formatted) to the extent I need it to be so.
Lastly, hiring managers don't tend to be coders. They may have worked their way up through the dev team hierarchy, but their job now, as a manager, is to tell you what they want coded, and send you off to go do it. They're not really interested in your exact solution; their concerns are related to the finished product. Does it work? Does it look good (for client-facing apps)? Does it perform well? Those are things that are difficult for you to demonstrate you can do with a code sample. They're much easier to demonstrate with a beefy resume of your past work, plus references from those past jobs that tell your prospective employer how impressed they were with your work.
As a result, I say don't bring code, unless it's your solutions to interview prep problems they give you. Instead, bring knowledge of the company, the industry they're in, the language/framework they're looking for (and others that may get the job done better), object-oriented design patterns and principles, data modeling, etc. Show them you know your stuff, and that you know their stuff, and you'll make yourself a hot commodity.