Is it okay to randomly charge your phone throughout the day? (htc one)

Hey,

I was wondering if it's okay to charge your phone throughout the day, like connect via usb to computer while at work, will that be bad for the battery for HTC one or is it okay?

Also give some tips on how and when should you charge your phone? At what battery percentage should you charge?

Thank you