I am currently taking computer science coursework as part of a computer science related degree at my University. I was wondering if I should upload the solutions I make for various trivial homework assignments (ie. not more than 20-30 or so lines of code, on basic/fundamental topics) to my GitHub account, or if I should only upload larger course/personal projects to it. I have only been regularly coding for about a year, and a large portion of the code I have written was for a company where I was under an NDA, so I was wondering if this would be an appropriate way to add more breadth to future job applications.
No, solutions to homework assignments are not likely to impress potential future employers.
Many professors would prefer that you not post solutions to homework assignments to public Github repositories. Why? If they ever reuse those problems in a future semester, then by making the solutions publicly available you are creating a temptation to cheat for other students, and that can be detrimental. So it would be a kindness to avoid publicly posting solutions.
If you are a student, you can get free unlimited private repositories on Github that you could use for homework assignments. Just make sure not to let them revert to public when you graduate.
I'd recommend that you talk with your professors. No one here can speak for your professor (unless your professors is here).
From my experience, I'd bet that most professors would love your enthusiasm but be very reluctant to allow it because of the issues with plagiarism and academic integrity. If you discuss it with the professor you may find that they are open to extra credit projects or something to give you some opportunity to add to your repositories. Go into the discussion fully expecting it to be a long shot.
I've had quite a few syllabi state that storing class work in a public repository would be considered a breach in our academic integrity policies, but at the same time I've also been given permission from other professors to use GitHub public repositories on a number of projects. It usually came down to if the mission of the project is unique to the student/team. When every team is creating a one of a kind project, it usually becomes less of a problem to create a public repository. The best luck I've had getting public GitHub repository approval was with professors that offed independent study extra credit opportunities and when we had group projects.
In any case, never assume that you can upload any coursework to a public repository! Discuss it with your professors.
For advanced homework solutions, I'd indeed consider polishing and uploading or writing a blog post about it.
The natural way to create advanced solutions is to solve advanced exercises that are stated openly, without a clear path/coding framework in mind — typically in M.Sc.-level courses. Alternatively, you can try to go above and beyond when solving simple exercises.
For instance, we were once asked to model a toy ontology language in a programming language of our choice, and I modelled it in Coq, the proof assistant. I do think there is some value in me having published that solution on GitHub; if only for the reason that it raises my incentive to improve it when I can spare time.
Whether professors generally mind students publishing their solutions, is apparently highly culture-dependent. The other answers by D.W. and Joshua096 report on the default in their experience being yes, i.e., you should always ask professors before hand.
In contrast, in the German academic culture I experienced, the default was that you can share anything. In fact, our student council publicly collects old written/oral exam questions. And professors know this; some even recommend you to take a look at them. Rarely do they kindly ask you to not publish things, knowing they couldn't/wouldn't want to go down to legal path of forcing you anyway.