XO.createNewInstanceOf: a factory

I’m thinking about logging at the class level. I’m thinking to have a
LoggedThig for every Thing, when needed. Then:

  XO.createNewInstanceOf(Thing)

would return an instance of Thing when in normal mode and an instance of
LoggedThig when in debug mode. If LoggedThig is not defined, it will
fall back to return an instance of Thing.

So across the app, I’ll need to use this function instead of the new
operator.
Use Q for deferrables

Trying to get to a point where I could run the unit tests with node
only. Since Angular.js can’t do that, I’ll cut dependencies to it. One
was XO.Deferrable, which now will use Q.js to provide promises.
Chnaged the directory structure for easier unit testing

Because PhantomJS takes 1.3s to start (which seems unfair), I wanted to
be able to run my tests without it. I mean it’s JS in the end, and Node
shouldbe able to run it.

One problem was that Firebase and Angular need a browser. So I had to
separate code that used the two into their own directory structure so
that I can easily pick and omit them when running tests. So I’ve
sparated the core logic into app/core, and everything else in
app/angular and app/firebase.

Now I have “test-unit” make task that only runs core tests with node,
and “test” make task that runs core + firebase + angular tests with
PhantomJS. The time difference is: .5 vs. 2.2 seconds, which is good.

One other problem was that I didn’t feel good having user registration
code in app/user/registration/: in its essesnce it’s a use-case, right?
So I created app/use-cases (which now is app/core/use-cases) and moved
that code it in there. (Some user registration code changes are also
included.)