41 karma · joined January 31, 2011
it("should wait for socket", function(done) { socket.write("asdfadf", function(err, response) { assert.ok(response.indexOf('token') >= ); done() ); });
#4 If you need a new event loop then write the tests in another module, then simply run your test utility. `mocha` will run all tests in test/*test.js.
RSpec is DOG SLOW! I can run 100s of test in a couple of seconds. Can RSpec even startup in that time?
Riak looks interesting but its overkill. They recommend at least three nodes. We went back to PostgreSQL.
I do agree the ThinkPad keyboards were the best in its class.
My point is the inconsistency of the driver API vs the syntax used in the `mongo` utility. I don't know how many times I've looked at the MongoDB docs and then have to figure how to do the same thing with this driver.
Yes Rails does all that for you automagically but you can use a lightweight ORM like FastLegS. A model is as simple as this:
UserDao = FastLegs.Base.extend({ tableName: "users", primaryKey: "id" });
To expose it:
app.get("/user/:id", function(req, res) { UserDao.find(req.params.id, function(err, result) { res.json(result.rows[0]); }); });
Let's not forget about unit tests. I can run well over 100 test cases in just over ONE second! Rails is PAINFULLY slow at this.
I've done enough Rails to know how productive it is, and there are many things I miss. I'll argue though I'm more productive with node.js since we do most GUI with Backbone on the client. I can share code between client and server, for example validations.
.
follow = (from, to, cb) ->
# Invokes four async operations in a series, which requires 4 `await`, `defer`
# using iced. Note how error handling is handled
# in one place rather than each step.
# That's a big drawback for me with await/defer.
async.series
user: (cb) -> User.find name:from, cb
addFollowing: (cb, results) ->
results.user.following.push to
User.save results.user, cb
followee: (cb) ->
User.find name:to, cb
addFollower: (cb, results) ->
results.followee.followers.push from
User.update results.followee, cb
, (err, results)
cb err, resultsI live in a terminal so Vim is my weapon of choice. I tried and bought a license for Sublime 2, which is awesome n vintage mode, but Sublime is not Vim.