Skip to content

Instantly share code, notes, and snippets.

View JakeTheCorn's full-sized avatar

Jake Corn JakeTheCorn

  • Indianapolis, IN
View GitHub Profile
// Stack operations will always have a time complexity of O(1) regardless the size of the stack
var Stack = function() {
this.count = 0;
this.storage = {};
}
Stack.prototype = (function() {
return {
nge.js
const NumRange = (function CreateRangeObject() {
return {
from: from
}
function from(num1) {
var arr = [];
return {
function memoizer(func) {
var cache = [];
return function(n) {
var idx = n.toString();
if (cache[idx] === undefined) {
cache[idx] = func(x);
}
return cache[idx];
}
var node = mockNode();
mapTree(node, upCase);
function upCase(string) {
return string.toUpperCase();
}
function mapTree(node, mapper) {
return {
// $log.log will call $log.debug instead which is globally configurable from the debugEnabled call
(function() {
'use strict';
angular.module('app')
.config(AppLogConfig);
AppLogConfig.$inject = ['$logProvider', 'IS_DEV_MODE', '$provide'];
var el = document.getElementById('hplogo');
var tearItDown = setClickListener(el, function() {
console.log('2222222');
});
tearItDown();
function setClickListener(element, fn) {
element.addEventListener('click', fn);
function getType(elem) {
return Object.prototype.toString.call(elem).slice(8, -1);
};
function IE_Wrapper(fn) {
return function(...params) {
if (window.ActiveXObject || 'ActiveXObject' in window) {
fn(...params);
}
}
}
// https://gist.github.com/JamieMason/172460a36a0eaef24233e6edb2706f83#file-es6-compose-md
// By: Jamie Mason
// https://gist.github.com/JamieMason
const compose = (...fns) =>
fns.reverse().reduce((prevFn, nextFn) =>
value => nextFn(prevFn(value)),
value => value
);
Array.prototype.shuffle = function() {
return this.sort(function() {
return 0.5 > Math.random();
});
}