A white chemistry professor has resigned after impersonating a female immigrant of color on Twitter to make racist and sexist comments.