Skip to content

Instantly share code, notes, and snippets.

View jakangah's full-sized avatar

Justice Adeenze-Kangah jakangah

  • KeySpecs
View GitHub Profile
@jakangah
jakangah / dateToArray.js
Created September 24, 2019 10:30
convert date to array
'use strict';
exports.dateToArray = date => {
date = date.getUTCDate ? date : new Date(date);
return [
date.getUTCFullYear(),
date.getUTCMonth() + 1,
date.getUTCDate(),
date.getUTCHours(),
date.getUTCMinutes(),
@jakangah
jakangah / me.json
Last active September 16, 2019 03:53
{
"swagger": "2.0",
"info": {
"version": "2.0.1",
"title": "payments"
},
"basePath": "/payments",
"consumes": [
"application/json"
],
version: '2.1'
services:
php:
tty: true
build:
context: .
dockerfile: tests/Docker/Dockerfile-PHP
args:
version: cli
volumes:
@jakangah
jakangah / js-tricky-bits.md
Created July 3, 2019 11:48 — forked from amysimmons/js-tricky-bits.md
Understanding closures, callbacks and promises in JavaScript

#Understanding closures, callbacks and promises

For a code newbie like myself, callbacks, closures and promises are scary JavaScript concepts.

10 months into my full-time dev career, and I would struggle to explain these words to a peer.

So I decided it was time to face my fears, and try to get my head around each concept.

Here are the notes from my initial reading. I'll continue to refine them as my understanding improves.

@jakangah
jakangah / jsonMissingVals.js
Created May 31, 2019 07:52
fixes json files parsed with missing values from an api
// fmjv = fixMissingJsonVals
// example {"a": , "b" : 2 , "c": }
function fmjv(json){
json.replace(/:,/g, ':"",')
json.replace(/:}/g, ':""}')
return JSON.parse(json)
}
@jakangah
jakangah / server.js
Created February 7, 2019 16:40
Implementing custom authorization when using express-graphql
# We accomplish this by passing the req and res objects from the expressjs router to the context option
# After getting the specific role or permission from the query instance we can accomplish route validation
let graphQLSchema = {
......
resolve: async function(root, args, context){
context.role = 'ADMIN'
}
}
@jakangah
jakangah / gist:f3645b1ce60a52d8e44661aa3d508347
Created October 27, 2016 08:17 — forked from mrash/gist:8383288c66f973a2bbb2
OpenSSL: Generate lcov code coverage report
#!/bin/sh
#
# Basic script to compile OpenSSL with code coverage support via gcc
# gcov and build HTML reports with lcov.
#
LCOV_DIR=lcov-results
LCOV_FILE=coverage.info
LCOV_FILTERED=coverage_final.info
PREFIX=~/install/openssl