Magnets designed for use with gates or to be used as latches