Bone Lenght scripted expression

Hello.
Recently I’ve come across this video which shows a cool trick to perform a foot roll using a single bone:

The problem is that the scripted expression used in the video apparently doesnt work on Blender 2.7x, and since I’m not a python literate, I have no idea why.
It seems as if the “len” property has changed, but I can’t find what has replaced it and how can I make it work again.
The original expressions were:

len*(1-cos(max(RotX,0)))
-len*sin(max(RotX,0))

Any help will be appreciated.