During gameplay pause the game and enter the code for the cheat you want to enable in the game. It is possible to have both codes enabled at the same time if you enter them one at a time. The codes will remain in effect until you beat the level or quit. Having either code enabled will prevent you from winning any awards.
Unlock Unlimited Energy: Press Y, L, Right and Select.
Unlock Unlimited Time: Press X, R, Down and Select.
To be able to select any level in the game without playing through it hold the B, L and Select buttons when you are viewing the first cutscene and ALL the levels for the profile you are using will become unlocked.