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 https = require('https'); | |
var old = 'https://app.astandes.com.br:8443'; | |
var url = require('url'); | |
var util = require('util'); | |
var fs = require('fs'); | |
var log = function(data, inout){ | |
inout = inout ? inout + ' ' : ''; | |
data = inout + data.trim().replace(/\n/g, inout); | |
if(data) |
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'); | |
var path = require('path'); | |
require('http').Server(function(req, res) { | |
if (!fs.existsSync(req.url)) { | |
res.statusCode = 404; | |
res.end(); | |
} | |
var name = path.basename(req.url); |
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
require('http').Server(function(req, res){ | |
console.log('%s %s', req.method, req.url); | |
var data = ''; | |
req.on('data', function(buff){ | |
data += buff; | |
}); | |
req.on('end', function(){ | |
console.log(data); |
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
# Proxies tasks to Grunt, so we don't need to install Grunt | |
# globaly on Unix machines. | |
%: | |
./node_modules/.bin/grunt $(MAKECMDGOALS) | |
.PHONY: test |
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'); | |
var path = require('path'); | |
var os = require('os'); | |
var cuid = require('cuid'); | |
var request = require('request'); | |
var Bluebird = require('bluebird'); | |
Bluebird.resolve().then(function(){ | |
console.log('Baixando captcha.'); |
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
{ | |
"auto_complete": true, | |
"bold_folder_labels": true, | |
"color_scheme": "Packages/User/Monokai (SL).tmTheme", | |
"detect_slow_plugins": false, | |
"dictionary": "Packages/Dictionaries/Portuguese (Brazilian).dic", | |
"drag_text": false, | |
"ensure_newline_at_eof_on_save": true, | |
"font_face": "Monaco", | |
"font_options": "subpixel_antialias", |
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 = require('./userSchema'); | |
user.validate({password: 'alan', email: 'huehue@br.br'}, function(err, data){ | |
if(err) | |
throw err; | |
//gravar o data no banco de dados | |
db.insert(data); | |
}); |
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 request = require('./request-helper'); | |
// Fazer uma requisição utilizando a jar global, que é compartilhada | |
// em todo o Node.js que está rodando | |
request.global({ | |
url: 'https://google.com.br' | |
}, function(err, res, body){ | |
if(err) | |
throw err; | |
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 request = require('request'); | |
var options = { | |
url: 'https://portaldocidadao.saude.gov.br/portalcidadao/validaNumeroCNS.htm', | |
proxy: 'http://huehuebr.com.br' | |
}; | |
request(options, function (err, res, body) { | |
if(err) | |
throw err; | |
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 request = require('request'); | |
var options = { | |
url: 'https://portaldocidadao.saude.gov.br/portalcidadao/validaNumeroCNS.htm', | |
proxy: 'http://huehuebr.com.br', | |
strictSSL: false | |
}; | |
request(options, function (err, res, body) { | |
if(err) | |
throw err; |