You might also want to check out the Snippets wiki which contains a lot of code snippets that you can reuse in your pages. And you can also check the Extensions wiki to install ready-to-use extensions built using these mechanisms.