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 mongoose = require('mongoose'); | |
var Schema = mongoose.Schema; | |
//Database connection | |
var uristring = 'mongodb://localhost/test'; | |
var mongoOptions = { }; | |
mongoose.connect(uristring, mongoOptions, function (err, res) { | |
if (err) { | |
console.log('Error when connecting to: ' + uristring + '. ' + 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
const assert = require('assert') | |
function getAnimals(fetch, id) { | |
return fetch('http://api.animalfarmgame.com/animals/' + id) | |
.then(response => response.json()) | |
.then(data => data.results[0]) | |
} | |
describe('getAnimals', () => { | |
it('calls fetch with the correct 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
var dependency1 = require('./dep1'); | |
export.fooBar = dep |
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
const AWS = require(`aws-sdk`) | |
const fs = require(`fs`) | |
const path = require(`path`) | |
const dir = `./sample-dir` | |
const bucket = `bucket-name` | |
const s3bucket = new AWS.S3({params: {Bucket: bucket}}) | |
fs.readdir(dir, (err, files) => { |
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
const AWS = require(`aws-sdk`) | |
const fs = require(`fs`) | |
const path = require(`path`) | |
const dir = `./sample-dir` | |
const bucket = `bucket-name` | |
const s3bucket = new AWS.S3({params: {Bucket: bucket}}) | |
async function readDirAsync(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
function createProduct(id, name, description, sku, colors, sizes, price, imageURL, thumbnailURL){ | |
// | |
// | |
} |
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
/* missing a RETURN statement */ | |
fs.readFile(`${filePath}`, (err, data) => { | |
if (err) { | |
console.log(`Error reading file: ${filePath}`) | |
} | |
//... | |
//code | |
//... |
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
function checkIfImageExist(src, cb) { | |
var img = new Image(); | |
img.onload = function() { | |
cb(null) | |
} | |
img.onerror = function(e) { |
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
global.myNumber = 5; //Global variable initialized to value 5. |
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
node debug $(which gulp) taskName |