Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am eokoneyo on github.
  • I am eokoneyo (https://keybase.io/eokoneyo) on keybase.
  • I have a public key ASAEAiIBq41hbPfC69MsiGxnyxSzswOD-mUb88zfgIEBaQo

To claim this, I am signing this object:

@eokoneyo
eokoneyo / git-commit-hook.sh
Last active July 21, 2022 15:50
script to automatically include JIRA ticket in Git commit message
#!/bin/bash
# get current branch
branchName=$(git rev-parse --abbrev-ref HEAD)
branchName_uc=$(echo "${branchName}" | tr '[:lower:]' '[:upper:]')
# search jira issue id in a pattern such a "feature/ABC-123-description"
jiraId=$(echo "${branchName_uc}" | sed -nE 's/([^/]*\/)*([a-zA-Z]+-[0-9]+).*/\2/p')
# get git commit message file
const validOps = ['+', '-', '*', '/'];
const compute = (rightOperand, leftOperand, operation) => {
switch (operation) {
case '+':
return leftOperand + rightOperand;
case '-':
return leftOperand - rightOperand;
case '*':
return leftOperand * rightOperand;
@eokoneyo
eokoneyo / list_external_scripts.js
Last active January 31, 2020 12:51
List external scripts being loaded on the HelloFresh Website
const resources = window.performance.getEntriesByType('resource');
const isHF = (resource) => /\w*\.(hellofresh|cloudflare)\.\w*/.test(resource);
const nonHFResources = resources.reduce((result, resource) => {
return !isHF(resource.name) ? result.concat(resource) : result
}, []);
'use strict';
/**
* @description dust helper for building pagination component.
* @example {@pager end=total_pages baseurl="/search" query=query /}
*/
let qs = require('query-string');
module.exports = (dust) => {
@eokoneyo
eokoneyo / export_external_docker_port.sh
Last active January 31, 2020 15:47
Expose external port of docker disposable container to .env file
#!/bin/bash
API_DOCKER_IMAGE_NAME="<image name>"
API_PORT=<port> #specify the port exposed in your dockerfile
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
ROOT="$(dirname "${SCRIPT_DIR}")"
if [[ $(docker ps --filter ancestor=${API_DOCKER_IMAGE_NAME} --format "{{.Status}}") ]]; then
//Codilty test for a test scenario on exmaple '(())))(' where example is split at the index K, where K
//is such that 0 <= K <= N, and N is size of K. At K the number of open
//brackets equals the number of closing brackets
function solution(S) {
// write your code in JavaScript (Node.js 6.4.0)
var index, left, right;
var len = S.length;
var filter = Array.prototype.filter;
for (var i = 0; i< len; i++) {
/*
@description function for determining Binary Gap in binary numbers,
inspired by a codility test
*/
function BinaryGap(N) {
var bin = N.toString(2);
//console.log(`We have been fed ${bin}`);