Skip to content

Instantly share code, notes, and snippets.


Chinedum Chiemela ccmelas

View GitHub Profile
ccmelas / click-outside.js
Created Oct 18, 2019
Directive for Handling outside clicks for Vue Components
View click-outside.js
function findElement(element, vnode = null) {
if (vnode) {
return vnode.context.$refs[element];
return document.querySelector(`#${element}`);
function elementContainsEvent(event, element, vnode = null) {
const domElement = findElement(element, vnode);
return domElement && domElement.contains(;
View Paystack.php
* Paystack payment service.
namespace App\Payments;
use GuzzleHttp\Client;
use Illuminate\Support\Facades\Log;
ccmelas / contactTest.js
Created Mar 9, 2019
Test for a certain "contact" feature 🤓
View contactTest.js
const chai = require('chai');
const chaiHttp = require('chai-http');
const app = require('../../index');
const { User, Contact } = require('../../database/models');
const should = chai.should();
let userData, contactData, user, token, otherUserData, otherUser;
ccmelas / ErroHandler.js
Created Mar 9, 2019
Generic error catching method for async functions. Allows you write async functions without the try/catch blocks. You instead wrap calls to those functions with the catchErrors method
View ErroHandler.js
* Handles application errors
class ErrorHandler {
* Wrapper for catching async/await errors
* @param {function} fn
* @returns {function} [Composed function with error handler attached]
static catchErrors(fn) {
You can’t perform that action at this time.