What is "code" and what should a DIYer know about it?
Codes are usually minimum safety standards.

However, in the vernacular, "code" is a loose term that includes national, state, county and local laws and ordinances that dictate or direct building practices of all kinds. The whim of the inspectors could also loosely be considered "code". Most of the time, the basis of these laws and whims are guided by or reference/include the works of standards bodies, such as the National Electrical Code, NFPA, and International Plumbing Code, to name a few.

Depending on the jurisdiction and disposition of the building inspectors, a good way to make sure you will meet code for a particular project is to ask the inspector to look at your plans before you start your work. Your mileage here will vary greatly. Some jurisdictions won't even return your calls if you're not a contractor.

A good way to plan a project is to find a book at your local hardware store on the subject. While "code" varies from place to place, there is a lot of uniformity and common ground. These practices will generally be followed in these books. In fact, many times these books address code directly. A book I recently used on deck building referenced the International Residential Code specifically in many sections when explaining a decision to be made.