What are the ethical considerations when using code found online for personal projects, and how can one ensure proper attribution and permission from the original author?

When using code found online for personal projects, it is important to consider the ethical implications of potentially infringing on the original author's intellectual property rights. To ensure proper attribution and permission, one should always check the licensing terms of the code and give credit to the original author in the project documentation or comments. Additionally, reaching out to the author directly to request permission to use their code is a good practice to avoid any legal issues.

// Example code snippet for proper attribution and permission
// Original code by John Doe (https://example.com)

// Your code implementation here

// End of code snippet