Sorry, but there is no general rule. Note that in a lot of cases Professor Ng has standalone vectors that are column vectors. Every time you are using a dot product, you need to check the shapes of the operands and you need to understand what the math formula is telling you to do in that case in order to know the order of the operands and whether any transposes are required or not.
Here’s a thread which talks about this in more detail and discusses the important notational conventions that Professor Ng uses.