Skip to content

Instantly share code, notes, and snippets.

@creationix
Forked from brianleroux/person.js
Created October 14, 2010 02:50

Revisions

  1. creationix revised this gist Oct 14, 2010. 1 changed file with 38 additions and 39 deletions.
    77 changes: 38 additions & 39 deletions person.js
    Original file line number Diff line number Diff line change
    @@ -1,51 +1,50 @@
    function Person() {

    // properties and validations
    attr(
    { id:Number, unique:true, nullable:false },
    { email:String, unique:true, nullable:false, min:1, max:55, format:'[a-b]' },
    { salt:String },
    { pswd:String },
    { active:Boolean, init:false },
    { tags:Array }
    this.attr(
    { id: Number, unique: true, nullable: false },
    { email: String, unique: true, nullable: false, min: 1, max: 55, format: '[a-b]' },
    { salt: String },
    { pswd: String },
    { active: Boolean, init: false },
    { tags: Array }
    );

    // helpful property declarations
    timestamp();
    this.timestamp();

    // callbacks
    creating({ before:poundSalt, after:emailActivationCode });
    updating();
    deleting();
    this.creating({ before: poundSalt, after: emailActivationCode });
    this.updating();
    this.deleting();

    // a private function to generate a unique salt for hashing the password, called in 'creating' callback
    // testable therefore by the creating callback?
    var poundSalt = function(obj) {

    };

    // emails an activation code
    var emailActivationCode = function(obj) {

    };


    var forgotPassword = function(obj) {

    };

    // public instance attributes
    this.prototype = {
    // activates the user account
    get active() {
    function poundSalt(obj) {

    },
    set active() {
    }

    // emails an activation code
    function emailActivationCode(obj) {

    }
    }



    function forgotPassword(obj) {

    }

    // views, beautiful custom finders
    view('tags', { map:function(){}, reduce:function(){} });
    view('popular');
    };
    this.view('tags', { map: function () {}, reduce: function () {} });
    this.view('popular');

    // public instance attributes
    return {
    // activates the user account
    get active() {

    },
    set active() {

    };
    }
  2. @brianleroux brianleroux created this gist Oct 13, 2010.
    51 changes: 51 additions & 0 deletions person.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,51 @@
    function Person() {

    // properties and validations
    attr(
    { id:Number, unique:true, nullable:false },
    { email:String, unique:true, nullable:false, min:1, max:55, format:'[a-b]' },
    { salt:String },
    { pswd:String },
    { active:Boolean, init:false },
    { tags:Array }
    );

    // helpful property declarations
    timestamp();

    // callbacks
    creating({ before:poundSalt, after:emailActivationCode });
    updating();
    deleting();

    // a private function to generate a unique salt for hashing the password, called in 'creating' callback
    // testable therefore by the creating callback?
    var poundSalt = function(obj) {

    };

    // emails an activation code
    var emailActivationCode = function(obj) {

    };


    var forgotPassword = function(obj) {

    };

    // public instance attributes
    this.prototype = {
    // activates the user account
    get active() {

    },
    set active() {

    }
    }

    // views, beautiful custom finders
    view('tags', { map:function(){}, reduce:function(){} });
    view('popular');
    };