A man who attacked his ex-partner in front of her child in Colchester was spared jail.