Maybe it won’t anwser your quastion direcly but i can tell you what you can by avoiding source based on my AnswerHub expirance
You are allowed to make snipits up to 30 lines, from FAQ:
“UE4 subscribers are permitted to post engine code snippets (up to 30 lines) in a public forum, but only for the purpose of discussing the content of the snippet.”
APIs documentation is public and they also contains code snippits of specific functions (some longer then 30 lines):
.unrealengine.com/latest/INT/API/index.html
Also UE4 is not one man army made engine like Carmack’s engines, it far more complex so i don’t know if you manage to present it in the way that you see on that site, you might try to generlise more without showing code and link to github so those who can access legaly the code can see it. GitHub let you link to specific line of code, by clicking on line number your url add hashtag to the line.
You might also be interested in UE4 free licence for academic use:
If you manage to equip your students with those there should be less problems ;]