You cannot get rotational position from the gyros alone. They drift with changes in temperature and other factors you cannot measure and correct.
Idaho's code seems to be using acceleration (the force of gravity) to do this without using the gyros at all.
Using both acceleration and the gyros will give you very accurate pitch and roll values. The math is complex and there are constants to tune to your preference. Google should find a dozen good examples.