I wouldn't feel bad or afraid of posting my homework code or the like on forums. If you made the code, then it's all green. If others copy it, then they have done something against the rules - and unethical, to boot. But that shouldn't concern you. You didn't hand them the code on purpose. You posted it on a board to get help and to allow others like you who have the same problem learn from your problem.
So don't concern yourself so much with cheaters. Think of it this way: you are helping other people who have a legitimate wish to learn. Let the school deal with non-serious students.