Viewing Mathematica Demonstrations Project Code
Usually you can scroll down the cdf and find a "Download Source Code" button:
Clicking this button downloads another notebook where the code is explicitly visible.
On other browsers/platforms, you may see this:
and if you click on (preview) you'll see this:
although you can't copy this, because it's a GIF...
In order to see the code in the demonstration files, you simply click on the right bar of the section with the code, and select 'convert to input form'...
Then you can copy the entire code snippet and paste it into your new file, where it will then get syntax formatting & coloring.