Man who farted in police officer's face is jailed for nearly 3 years