Congruence properties of ordinary and $q$-binomial coefficients