Split string into n pieces (or pieces of length n) The Challenge
In this challenge you have to do two different (but related) tasks depending of the order of the input.
Your program will recieve a string s and an integer n as input and will

split s into pieces of length n if s comes first. The last element will be shorter if necessary.
split s into n pieces of equal length if n comes first. If len(s) is not a multiple of n the first len(s) mod n elements will be one longer.

You may only take those 2 inputs. s will never contain only digits.
Notes

You may use the reverse mapping. Note this in your answer if you do that.
s will only contain printable ASCII characters (no newlines).
You may not use any builtins that solve either those two tasks directly. All other builtins are allowed.
You have to take both arguments from the same source.
You may take the arguments in an ordered list or any other format which clearly indicates their order as long as it is unambiguous.
You may take the input as one string/ stream and use a character which is not a valid input (like a nullbyte) to separate them.
n will always be equal or less than the length of s and greater than zero.
You may output the resulting list in any resonable format as long as it clearly indicates the particular pieces and their order.

Example
Input:  programming, 3
The last element contains only 2 characters, because 11 is not divisible by 3.
Output: [&quot;pro&quot;, &quot;gra&quot;, &quot;mmi&quot;, &quot;ng&quot;]
Input: 3, programming
11 is not a multiple of 3, so the first 2 elements will be one longer:
Output: [&quot;prog&quot;, &quot;ramm&quot;, &quot;ing&quot;]
Rules

Function or full program allowed.
Default rules for input/output.
Standard loopholes apply.
This is code-golf, so lowest byte-count wins. Tiebreaker is earlier submission.

Test cases
The test cases got generated with this Pyth program (uses builtins, so no valid answer). Thanks to @FryAmTheEggman for providing the base version of that!

3, helloworld -> ['hell', 'owo', 'rld']
helloworld, 3 -> ['hel', 'low', 'orl', 'd']
1, programming -> ['programming']
programming, 1 -> ['p', 'r', 'o', 'g', 'r', 'a', 'm', 'm', 'i', 'n', 'g']
8, programming -> ['pr', 'og', 'ra', 'm', 'm', 'i', 'n', 'g']
programming, 8 -> ['programm', 'ing']
9, code golf -> ['c', 'o', 'd', 'e', ' ', 'g', 'o', 'l', 'f']
code golf, 9 -> ['code golf']
4, 133tspeak -> ['133', 'ts', 'pe', 'ak']
133tspeak, 4 -> ['133t', 'spea', 'k']

Happy Coding!
JavaScript (ES6), 132 bytes

(s,t)=&gt;+t?[...Array(-~(~-s.length/+t))].map((_,i)=&gt;s.substr(i*t,t)):[...Array(s=+s)].map(_=&gt;t.slice(p,p-=~((t.length-p-1)/s--)),p=0)


This is probably hopelessly over-engineered.