Add truncate & truncateFromCenter with test

This should be better right now :smile: 
Make sure there's a line break at the end of the file.