As long as you control the copyright of your code you can use it as a code sample. You can also use open source code as long as you credit the original authors.

Did this answer your question?