I've used full work/libraries written by other people in the past, and it's quite easy: respect the attribution as asked.
The work I think of is actually a codepen, no mention of attribution in the code, no comment, nothing specifically asked. I've tested the code, found it useful, and have modified it. A lot. Basically, I kept 15% (tops), and wrote my own scripts.
It's a website for a sports association (NPO) and I do this pro bono, it's a small shop online for their (tee-)shirts (1 page, 1 cart, 1 checkout, 1 contact, 1 about us). I needed a simple shopping cart (based on localStorage, no DB), I found a model on codepen. I've used the idea, a couple of lines/functions, but modified the core of the script(s). Nevertheless, I did gain some valuable time (and ideas) for sure.
I think like tagging my work as: "Based on xxx" or "Inspired by xxx". Is there good practice/etiquette for this and how credit shall be given?
Please edit tags as I couldn't find some fitting the question, did my best on that...