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
// Node.js CheatSheet. | |
// Download the Node.js source code or a pre-built installer for your platform, and start developing today. | |
// Download: http://nodejs.org/download/ | |
// More: http://nodejs.org/api/all.html | |
// 0. Synopsis. | |
// http://nodejs.org/api/synopsis.html | |
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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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("/", function(req, res){ | |
fetchModel() | |
//Second Call | |
.then(scanDifferences /*, **Function for on reject** */) | |
//Third Call | |
.then(insertNewones /*, **Function for on reject** */) | |
//Last Call | |
.done(function(promise){ | |
res.json({"Name": "Hello"}) | |
}); |
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
example() | |
//Second Call | |
.then(example2 /*, **Function for on reject** */) | |
//Third Call | |
.then(example3 /*, **Function for on reject** */) | |
//Last Call | |
.done(function(promise){ | |
console.log(promise.new); | |
console.log("Finished"); | |
}); |
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
example() | |
.then(example2) | |
.then(example3) | |
.done(function(promise){ | |
console.log(promise.new); | |
console.log("Finished"); | |
}); |
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
// Call the requirements | |
var express = require('express'); | |
var app = express(); | |
var bodyParser = require('body-parser'); | |
var morgan = require('morgan'); | |
var mongoose = require('mongoose'); | |
var port = process.env.PORT || 8080; | |
//var User = require('./model/Users'); | |
Q = require("q"); |
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
//First http connection | |
(function(){ | |
var deferred = Q.defer(); | |
var url = "http://takeoutapi.azurewebsites.net/api/menu/", response; | |
var checkConn = Ti.Network.createHTTPClient({ | |
//On Sucess | |
onload : function() | |
{ | |
//Q | |
Ti.API.info("onload: "+this.responseText); |
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.model = function(){ | |
//Declare our dictionary to return to the table view | |
var model; | |
//Connection Example | |
/* | |
* First we create our url and our response variable and then create our client function | |
*/ | |
var url = "http://takeoutapi.azurewebsites.net/api/menu/", 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
git clone git://github.com/ry/node.git | |
cd node | |
./configure | |
make | |
sudo make install |
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 gente ={}; | |
gente.people="nombre"; | |
gente.name="Edwin" | |
alert(gente); |