This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| for relation in relations | |
| for key, value of relation | |
| console.log "#{key}: #{value}" | |
| if typeof value is "object" | |
| for subkey, subvalue of value | |
| console.log "inner: #{subkey}: #{subvalue}" | |
| if subvalue is "newId" | |
| console.log "I changed #{subkey} from #{subvalue} to #{id}." | |
| value[subvalue] = id | |
| console.log subvalue |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| app.get "/person/:wid("+ people.idRegex +")/remove" | |
| becomes | |
| app.get("/person/:wid(" + people.idRegex(+")/remove")); | |
| when I'm trying to get | |
| app.get("/person/:wid(" + people.idRegex +")/remove"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| exports.test = function(){ | |
| console.log(this) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Main bug.js app | |
| express = require("express"); | |
| app = express.createServer(); | |
| bugmodel = require("./bugmodel"); | |
| anotherContext = function(req, res, next){ | |
| bugmodel.test(); | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var getUsers; | |
| getUsers = function(peopleArray, callback) { | |
| var person, _i, _len, _results; | |
| _results = []; | |
| for (_i = 0, _len = people.length; _i < _len; _i++) { | |
| person = people[_i]; | |
| _results.push(getUser(person, function(err, response) { | |
| users.push(response); | |
| return res.users = users; | |
| })); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| exports.list = (req, res, next) -> | |
| users = new Array | |
| getList (err, response) -> | |
| if err? | |
| next err | |
| else | |
| people = response | |
| for person in people | |
| getUser person, (err, callback) -> | |
| users.push(response) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| exports.register = function(req, res, next) { | |
| var client; | |
| client = this.client; | |
| return exports.validate(req, res, function() { | |
| return client.hmset("person:" + req.body.wid, req.body, function(err, response) { | |
| if (err != null) { | |
| return next(err); | |
| } else { | |
| req.newUser = req.body; | |
| console.log("success. Saved record."); |
NewerOlder