This file contains 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.js | |
var users = app.resource('users', require('./controllers/users')); | |
users.map('get', '/login', users.login); | |
//users.js | |
exports.login = function(req, res){ | |
res.end('login'); | |
}; | |
//error |
This file contains 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
PHP Deprecated: Comments starting with '#' are deprecated in /etc/php5/cli/conf.d/imagick.ini on line 1 in Unknown on line 0 | |
PHP Deprecated: Comments starting with '#' are deprecated in /etc/php5/cli/conf.d/mcrypt.ini on line 1 in Unknown on line 0 | |
PHP Deprecated: Comments starting with '#' are deprecated in /etc/php5/cli/conf.d/mhash.ini on line 1 in Unknown on line 0 | |
No log handling enabled - turning on stderr logging | |
MIB search path: /root/.snmp/mibs:/usr/share/mibs/site:/usr/share/snmp/mibs:/usr/share/mibs/iana:/usr/share/mibs/ietf:/usr/share/mibs/netsnmp | |
Cannot find module (HOST-RESOURCES-MIB): At line 1 in (none) | |
Cannot find module (HOST-RESOURCES-TYPES): At line 1 in (none) | |
Cannot find module (SNMPv2-TC): At line 10 in /usr/share/mibs/netsnmp/UCD-DLMOD-MIB | |
Cannot find module (SNMPv2-SMI): At line 34 in /usr/share/mibs/netsnmp/UCD-SNMP-MIB | |
Cannot find module (SNMPv2-TC): At line 37 in /usr/share/mibs/netsnmp/UCD-SNMP-MIB |
This file contains 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.create = function(req, res, next){ | |
req.form.on('fileBegin', function(name, file){ | |
console.log(file); | |
console.log(name); | |
}); | |
req.form.on('progress', function(bytesReceived, bytesExpected){ | |
if (bytesExpected > app.settings.maxUpload) { | |
next(new Error('File larger than ' + app.settings.maxUpload/1024 + ' megabytes.')); | |
} |
This file contains 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 twitter = require('ntwitter') | |
, jsdom = require('jsdom') | |
, Log = require('log') | |
, fs = require('fs') | |
, log = new Log('info', fs.createWriteStream('app.log')) | |
, XXX; | |
var twit = new twitter({ | |
consumer_key: 'XXX', | |
consumer_secret: 'XXX', |
This file contains 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 fs = require('fs') | |
, async = require('async'); | |
exports.newUpload = function(path, f) { | |
var i = 0 | |
, p = path; | |
async.until( | |
function () { | |
p = (i !== 0) ? path + i : path; |
This file contains 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
// FIRST WAY | |
//routes.js | |
module.exports = function (app, client, config) { | |
var Index = require('../controllers/index') | |
, index = new Index(app, client, config); | |
app.get('/', index.index); | |
}; | |
//index.js |
This file contains 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 hostname = url.parse(post.url).hostname; | |
if (hostname.indexOf('vimeo') != -1) { | |
var id = url.parse(post.url).pathname; | |
if (id) { | |
post.type = 'vimeo'; | |
post.videoID = id; | |
} else { | |
post.type = 'link'; | |
} | |
} else if (hostname.indexOf('youtu') != -1) { |
This file contains 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
// user model | |
module.exports = function (user) { | |
// new user with 'user' | |
this.save = function() { | |
// save 'user' | |
}; | |
}; |
This file contains 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 User = function (user) { | |
this.user = user; | |
}; | |
User.prototype.all = function (callback) { | |
var User = this; | |
var users = []; | |
/* snip */ | |
callback(error, users); | |
}; |
This file contains 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
// USER MODEL | |
var User = function (user) { | |
this.user = user; | |
}; | |
User.prototype.all = function (callback) { | |
var User = this; | |
var users = []; | |
/* snip */ |
OlderNewer