Can you projects be stolen on GitHub?
If you are worried, why don't you put only smaller samples of code? you can't claim someone has stolen your scenegraph implementation since thousands did he same already. Or have you invented some unique algorithm that you want to show? If you have, can't you write up a whitepaper on the matter? That would be even cooler in the eyes of an employer.
Sorry to be harsh but it's pretty hard to imagine if someone at this time invents something that wasn't invented before that can be stuffed into small example code that an employer could skip through during an interview.
EDIT: In my opinion (correct me if my view is wrong) sample codes on interviews are really good just for some overview of your coding style. Naming conventions, cleanness, whatever. So any generic, otherwise not interesting codes would suffice. Now that I think of it, maybe the way you write the most boring framework setup code is more telling than how you write fancy algorithms.
In reality, no one cares enough about your code to steal it. Chances are good no one will even see your code on GitHub unless you're out there promoting it or sending it to employers.
Once you've put the code out in public, you really can't stop people from misrepresenting the code as their own. You can license it such that you require attribution, or as GPL does: also require users of your code to submit their changes for you to consider rolling into your codebase. The license affords you a well-defined legal standing, such that you can pursue the matter in court; but it does nothing to stop a dishonest person from misrepresenting the code as their own, and you would need to discover their breach and initiate legal action to have them punished.
Expecting and requiring attribution is all fine and good. When we get to your motivations beyond that, I think its worth some introspection on your part -- Is the code you're making public really so special that its a significant head start for those that would adopt it, and so you would expect to be credited and possibly paid? Or, is the code really not that special, and you're reacting to a more visceral, emotional response that tells you that the code is yours and you should be recognized or compensated for it?
We all grow attached to our own hard work, and justifiably so -- but at the same time, its helpful to maintain a certain perspective about the outside world and the level of work that thousands of people donate to society every day. There's tons of bleeding-edge technology put into open-source operating systems like Linux, lots of code made available from advanced research projects, and so on. It might simply be best for your own conscience and sense of karma to simply require attribution, and then not worry yourself about it any further and content yourself knowing that you've helped out whomever might adopt your code simply by doing something you've done anyway.
throw table_exception("(? ???)? ? ???");
Wrap your code in tinfoil. I wrap my head in tinfoil and NSA can no longer steal my ideas.
What licence did you release the code under?
http://erebusrpg.sourceforge.net/ - Erebus, Open Source RPG for Windows/Linux/Android
http://conquests.sourceforge.net/ - Conquests, Open Source Civ-like Game for Windows/Linux