I was wondering if it is legal to use code in a public gist since Gists don't come with a license. I was not able to find any licensing info about public Gists online.
According to https://softwareengineering.stackexchange.com/a/26607/354680, copyright applies by default, except for fair use. There is some irony that I quote from a quote:
Explicitly mentioning the copyright in your work was an obligation in the past. It is no more required.
If the country you are in is a member of berne convention, then it's automatic. You have the full rights on your work.
The only exception to this is when your work is used in the context of "fair use". For example, I can copy/paste portion of text from internet or a book to illustrate what I explain. That's what I'm going to do right now, I'm fearless...
Copyright does not prohibit all copying or replication. In the United States, the fair use doctrine, codified by the Copyright Act of 1976 as 17 U.S.C. § 107, permits some copying and distribution without permission of the copyright holder or payment to same. The statute does not clearly define fair use, but instead gives four non-exclusive factors to consider in a fair use analysis.
This is from WikiPedia.
However, not explicitly mentioning the copyright may make some companies not very well informed on their rights & obligations to use your code in good faith.
You want to avoid all the paper work to force them to stop using your code, so as a general rules, even if it's not an obligation:
Add copyright statement in each source code file. Attach the full license to the project.