Some of these examples are full Drupal Modules, or snippets/functions from bigger components. They might also be ancillary code such as lambda functions from AWS, or anything else that represents something useful and/or meaningful.
In most cases I have not been working in a vacuum, and some of the code has either been modified by someone else or it could have been based on code by someone else but in all cases the majority if not the entirety of the functionally specific code is my own, that is to say that the patterns might not be but the specific premise is.
Most of this is code 'as is' from production environments where in many cases priorities shifted and inline code documentation didn't always get prioritised.