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 timer = { | |
start: function (s) { | |
this.stop(); | |
this.name = s; | |
this.startts = Date.now(); | |
}, | |
stop: function () { | |
if (!this.name) return; | |
this.endts = Date.now(); |
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
module.exports = function (nconf) { | |
var amqp = require('amqp'), | |
winston = require('winston'); | |
var config = nconf.get('amqp'); | |
var externalMessageCallback; | |
var openQueue = function (conn, queueName, passive, cb) { | |
var queueOptions = { |
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 parse(json, defaultValue) { | |
try { | |
return JSON.parse(json); | |
} catch (e) { | |
return defaultValue; | |
} | |
} | |
var json = JSON.stringify({a: 1, b: 2, c: 3, d: 4}); |
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 asyncA = () => Promise.resolve('A'); | |
const asyncB = () => Promise.resolve('B'); | |
const asyncC = (name) => Promise.resolve(`${name}+C`); // e.g. "A+C" | |
// Please write a function that requests these 3 async functions and combines the results into a single object: | |
const callAsync = () = { ... } | |
callAsync().then(result => console.log(result)); // should print: {a: 'A', b: 'B', c: 'A+C'} | |
// asyncA and asyncB are independent, should be called in parallel |
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 asyncA = () => Promise.resolve('A'); | |
const asyncB = () => Promise.resolve('B'); | |
// Please write a function that calls these 2 async functions in parallel and combines the results into a single object. | |
// asyncA and asyncB are independent, should be called in parallel. | |
const callAsync = () => { | |
// your code should be here | |
// ... | |
} |
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 asyncA = () => Promise.resolve('A'); | |
const asyncC = (prefix) => Promise.resolve(`${prefix}+C`); // e.g. "x+C" | |
// Please write a function that calls these 2 async functions and combines the results into a single object. | |
// asyncC takes the "prefix" argument - should be the resolved result of the asyncA() promise (which means asyncC depends on asyncA). | |
// Basically, first need to call asyncA, then pass the result to asyncC, then combine the both results into the single output object. | |
const callAsync = () => { | |
// your code should be here | |
// ... | |
} |
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 someHtmlContent = '<strong>highlighted text</strong> and regular text'; | |
const HtmlComponent = () => { | |
return ( | |
<div> | |
<h2>Rendering HTML content below</h2> | |
<div>/* How do you put the html content inside? */</div> | |
</div> | |
); | |
} |
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
swagger: '2.0' | |
info: | |
title: Test | |
description: Test | |
version: 4.0.0 | |
host: crunchbase.com | |
schemes: | |
- https | |
basePath: /v4 | |
produces: |
OlderNewer