first add this function to your functions.php file
function max_title_length($title){
$max = 20;
return substr( $title, 0, $max ). " …";
}
then before the loop of the code you linked add this line to hook the above function:
add_filter( 'the_title', 'max_title_length');
and after the loop remove this filter:
remove_filter( 'the_title', 'max_title_length');
and just change $max = 20;
to whatever you want.