Here are 8 snippets of code that have helped me in recent projects.