- [前端细节美化][1]
- [GitHub黑魔法集合][2]
- [JavaScript教程][3]
- [开源写作工具][4]
- [前端学习资源大集合][5]
- [Go、Python、C][6]
- [Python设计模式集合][7]
- [安卓开发者中文文档][8]
Encrypting text fields in Mongoose is easy using Node's built-in crypto module. You might want to do this if you're using MongoDB as a service (see the recent MongoHQ security breach); or, if you're storing OAuth tokens that could, in the wrong hands, screw with somebody's account on a 3rd party service. (Of course, you should never encrypt passwords: those should be hashed.)
Imagine you have a Mongoose model like that shown below, which is modified only slighly from the example on the MongooseJS homepage.
var mongoose = require('mongoose');
mongoose.connect('mongodb://localhost/test');
var User = mongoose.model('User', {
name: String,
Drop in replace functions for setTimeout
and setInterval
that make use of requestAnimationFrame
.
See overview article and Paul Irish's earlier post.
Courtesty of Joe Lambert
Copyright 2011, Joe Lambert.
Free to use under the MIT license.
http://www.opensource.org/licenses/mit-license.php