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 getFormattedDate = function(distance){ | |
var days = Math.floor(distance / (1000 * 60 * 60 * 24)); | |
var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)); | |
var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60)); | |
var seconds = Math.floor((distance % (1000 * 60)) / 1000); | |
return days + "d " + hours + "h " + minutes + "m " + seconds + "s "; | |
} | |
var container = $('#demo'); |
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
const getEnvVar = (key, safeDefault) => { | |
if (Object.prototype.hasOwnProperty.call(process.env, key) && !(typeof (process.env[key]) === 'undefined')) { | |
return process.env[key]; | |
} | |
return safeDefault; | |
}; | |
// Use it like | |
const config = { | |
serverUrl: getEnvVar('SERVER_URL', 'http://localhost:8080') |
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
server.post('/test-runs', async (req, res, next) => { | |
try{ | |
console.log('Kicking off test run'); | |
exec('npm test', (error, stdout, stderr) => { | |
if (error) { | |
console.error(`Error running tests: ${error.message}`); | |
} | |
console.log(stdout); | |
console.error(stderr); | |
}); |
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 couchbase = require('couchbase'); | |
class CouchbaseReporter { | |
constructor(globalConfig, options) { | |
this._globalConfig = globalConfig; | |
this._options = options; | |
const cluster = new couchbase.Cluster(`couchbase://127.0.0.1`); | |
cluster.authenticate('genericUser', 'dontStealMe'); | |
this.bucket = cluster.openBucket('default'); | |
} |
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
#!/usr/bin/env bash | |
until $(curl --output /dev/null --silent --head --fail http://$HOST_IP:8080/test-runs/$TEST_RUN_ID) ; do | |
echo "Still waiting for Schema Registry to become available"; | |
sleep 5; | |
done; |
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
/** | |
* Sleep for the specified number of seconds | |
* | |
* @param {number} seconds - Number of seconds to sleep for | |
* @returns {Promise} | |
*/ | |
const sleep = async (seconds) => { | |
return new Promise(resolve => { | |
setTimeout(resolve, (seconds * 1000)); | |
}); |
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
#!/usr/bin/make | |
run: | |
HOST_IP=$(shell ifconfig en0 | grep inet | grep -v inet6 | awk '{print $$2}') docker-compose -f confluent.yml up -d | |
# In your docker-compose file you can use something like: | |
# version: '3' | |
# services: | |
# zookeeper: | |
# image: confluentinc/cp-zookeeper:5.1.0 |
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 contents of consumer.config | |
bootstrap-servers=[KAFKA HOST] | |
exclude.internal.topics=true | |
group.id=mirror-maker | |
auto.offset.reset=latest | |
# Example contents of producer.config | |
bootstrap-servers=[KAFKA HOST] | |
acks=-1 | |
batch.size=100 |
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
export const setMock = jest.fn(); | |
export const getMock = jest.fn(); | |
const mock = jest.fn().mockImplementation(() => { | |
return { | |
set: setMock, | |
get: getMock | |
}; | |
}); |
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
module.exports = { | |
testEnvironment: 'node', | |
silent: false, | |
reporters: [ | |
'default', | |
'couchbaseReporter' | |
] | |
}; |