Skip to content

Instantly share code, notes, and snippets.

View q-ode's full-sized avatar
💭
I may be slow to respond.

Adebayo Adesanya q-ode

💭
I may be slow to respond.
View GitHub Profile
@q-ode
q-ode / run.sh
Created August 13, 2019 10:51
Run necessary containers
#!/usr/bin/env bash
docker run -d -p 27017:27017 mongo
docker run -d -p 6379:6379 redis
docker run -d -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" docker.elastic.co/elasticsearch/elasticsearch:7.2.0
@q-ode
q-ode / start.sh
Created August 13, 2019 10:39
Start a service
#!/usr/bin/env bash
export MONGODB_CONNECTION_STRING_URI=mongodb://localhost:27017
export MONGODB_NAME=collection-name
export ELASTICSEARCH_NODES="[\"http://localhost:9200\"]"
export REDIS_MASTER_SERVICE_HOST=localhost
export REDIS_MASTER_SERVICE_PORT=6379
#REDIS_MASTER_PASSWORD=
export NODE_ENV=production
@q-ode
q-ode / sample-publish-pacts.js
Created July 26, 2019 13:42
Sample Broker Publishing
const fs = require('fs');
const pact = require('@pact-foundation/pact-node');
const path = require('path');
// Modify as required
const pactBroker = process.env.PACT_BROKER;
const pactBrokerToken = process.env.PACT_BROKER_TOKEN;
const gitBranch = process.env.CIRCLE_BRANCH;
const gitCommitHash = process.env.CIRCLE_SHA1;
@q-ode
q-ode / sample-provider-verification.js
Created July 26, 2019 13:37
Sample Provider verification using Jest
import pact from '@pact-foundation/pact-node/src/pact';
describe('Provider', () => {
it('satisfies all Contracts', async () => {
const provider = process.env.CIRCLE_PROJECT_REPONAME;
const pactBroker = process.env.PACT_BROKER;
const pactBrokerToken = process.env.PACT_BROKER_TOKEN;
const gitBranch = process.env.CIRCLE_BRANCH;
const gitCommitHash = process.env.CIRCLE_SHA1;
const providerBaseUrl = 'http://localhost:80';
@q-ode
q-ode / sample-jest-pact.js
Created July 26, 2019 10:36
Sample Pact Generation using Jest
import { Pact } from '@pact-foundation/pact';
import path from 'path';
import axios from 'axios';
describe('sampleProvider', () => {
const port = 1234;
const providerBaseUrl = `http://localhost:${port}`;
const provider = new Pact({
consumer: 'sample-consumer',
provider: 'sample-provider',

Keybase proof

I hereby claim:

  • I am q-ode on github.
  • I am q_ode (https://keybase.io/q_ode) on keybase.
  • I have a public key ASBFn9kMrjvChbTQOH2nFpc3uVK3R6ORWzng4u9UNG7awAo

To claim this, I am signing this object:

{
"account_id": "A1.1",
"account_number": "12345678",
"additional_icons": {
"48x48": "https://api.figo.me/assets/images/accounts/default_48.png",
"60x60": "https://api.figo.me/assets/images/accounts/default_60.png",
"72x72": "https://api.figo.me/assets/images/accounts/default_72.png",
"84x84": "https://api.figo.me/assets/images/accounts/default_84.png",
"96x96": "https://api.figo.me/assets/images/accounts/default_96.png",
"120x120": "https://api.figo.me/assets/images/accounts/default_120.png",
{
"transactions": [
{
"booking_key": "MSC",
"bic": "FIGODE12345",
"categories": [
{
"parent_id": null,
"id": 11,
"name": "Einkommen"
@q-ode
q-ode / ultimate-ut-cheat-sheet.md
Created June 18, 2018 20:10 — forked from yoavniran/ultimate-ut-cheat-sheet.md
The Ultimate Unit Testing Cheat-sheet For Mocha, Chai and Sinon

The Ultimate Unit Testing Cheat-sheet

For Mocha, Chai and Sinon

using mocha/chai/sinon for node.js unit-tests? check out my utility: mocha-stirrer to easily reuse test components and mock require dependencies


@q-ode
q-ode / sequential-promise.js
Last active November 17, 2017 11:32
Sequential Promise Execution
const arrayOfSlackMessages = [1, 2, 3, 4, 5];
const waitTimes = [1000, 2000, 5000, 10000];
function sendSlackMessage(message, waitTime) {
return new Promise(function (resolve, reject) {
setTimeout(function () {
resolve();
}, waitTime);
})
}