Skip to content

Instantly share code, notes, and snippets.

View pdtaylor's full-sized avatar

Paul D. Taylor pdtaylor

  • @accentuate-technology-solutions
View GitHub Profile
var https = require('https');
var fs = require('fs');
var options = {
hostname: 'encrypted.google.com',
port: 443,
path: '/',
method: 'GET',
key: fs.readFileSync('/yourapp/certs/privkey.pem'),
cert: fs.readFileSync('/yourapp/certs/bundle.pem'), // a PEM containing the SERVER and ALL INTERMEDIATES
rejectUnauthorized: true
var https = require('https');
var fs = require('fs');
var options = {
hostname: 'encrypted.google.com',
port: 443,
path: '/',
method: 'GET',
ca: [fs.readFileSync('/yourapp/certs/intCA1Cert.pem'), fs.readFileSync('/yourapp/certs/ rootCACert.pem')],
rejectUnauthorized: true
};
var https = require('https');
var fs = require('fs');
var options = {
hostname: 'encrypted.google.com',
port: 443,
path: '/',
method: 'GET',
key: fs.readFileSync('/ yourapp/certs/key.pem'),
cert: fs.readFileSync('/yourapp/certs/cert.pem'),
rejectUnauthorized: true
var https = require('https');
var options = {
hostname: 'encrypted.google.com',
port: 443,
path: '/',
method: 'GET',
rejectUnauthorized: false
};
var req = https.request(options, function(res) {
@pdtaylor
pdtaylor / example1-test.js
Last active August 29, 2015 14:14
Example 1 Test
describe("The selectAnimal function", function(){
it("should return Cat"){
expect(window.myLib.selectAnimal("c")).toBe("Cat");
};
it("should return Dog"){
expect(window.myLib.selectAnimal("d")).toBe("Dog");
};
it("should return unknown"){
expect(window.myLib.selectAnimal()).toBe("unknown");
}
@pdtaylor
pdtaylor / example5.js
Last active August 29, 2015 14:14
Example 5
(function(){ //opens the closure
//definition of private object Animal
var Animal= function(){
this.name="";
};
Animal.prototype={
getAnimal : function(code){
var s = this;
@pdtaylor
pdtaylor / example5-test.js
Created January 27, 2015 18:13
Example 5 Test
describe("The getAnimalCallBackFn function", function(){
it("should set Animal name property"){
window.myLib.initialize();
window.myLib.selector.getAnimal ();
window.myLib.selector.getAnimalCallBackFn("dog");
expect(window.myLib.selector.name).toBe("dog");
};
});
@pdtaylor
pdtaylor / example4.js
Last active August 29, 2015 14:14
Example 4
(function(){ //opens the closure
//definition of private object Animal
var Animal= function(){
this.name="";
};
Animal.prototype={
getAnimal : function(code){
//AJAX call to get the description
@pdtaylor
pdtaylor / example3.js
Last active August 29, 2015 14:14
Example 3
(function(){ //opens the closure
//definition of private object Animal
var Animal= function(){
this.name="";
};
Animal.prototype={
getAnimal : function(code){
if(code=="c"){
@pdtaylor
pdtaylor / example3-test.js
Last active August 29, 2015 14:14
Example 3 Test
describe("The getAnimal function", function(){
beforeEach(function(){
window.myLib.initialize();
});
it("should set Animal name property to Cat"){
window.myLib.selector.getAnimal("c")
expect(window.myLib.selector.name).toBe("Cat");
};
it("should set Animal name property to Dog"){
window.myLib.selector.getAnimal("d")