Skip to content

Instantly share code, notes, and snippets.

View ugitch's full-sized avatar
:octocat:
Dream big and stay grounded..

Ugljesa Ijacic ugitch

:octocat:
Dream big and stay grounded..
  • Trebinje, Bosnia and Herzegovina
View GitHub Profile
@ugitch
ugitch / librarySystemWithDependencies.js
Last active June 5, 2019 22:04
Library system function for loading libraries which relies on loading dependencies for the library
(function(root, undefined) {
'use strict';
const libraryStorage = {};
function librarySystem(libraryName, dependencies, callback) {
// create library
if (arguments.length > 1) {
let availableDependencies = [];
let missingDependencies = [];
@ugitch
ugitch / runWithDebugger.js
Last active May 22, 2019 17:09
Run the function with the debugger
// with spread operator
function runWithDebugger(callback, argsForCallback) {
debugger;
if (argsForCallback !== undefined && Array.isArray(argsForCallback)) {
return callback(...argsForCallback);
} else {
return callback();
}
}
@ugitch
ugitch / mocha-guide-to-testing.js
Created October 20, 2016 22:21 — forked from samwize/mocha-guide-to-testing.js
Explain Mocha's testing framework - describe(), it() and before()/etc hooks
// # Mocha Guide to Testing
// Objective is to explain describe(), it(), and before()/etc hooks
// 1. `describe()` is merely for grouping, which you can nest as deep
// 2. `it()` is a test case
// 3. `before()`, `beforeEach()`, `after()`, `afterEach()` are hooks to run
// before/after first/each it() or describe().
//
// Which means, `before()` is run before first it()/describe()