In my experience code samples are a waste of time for the following reasons.
1. They might think you just copied the code from someone elses site and changed a few things to make it your own.
2. This could be code that you coded, but in reality it belongs to a company that you worked for and therefore is a legal no no.
This is from several recruiters who are friends of mine as well as from some hiring managers. I used to think it was a good idea until I found out this info.