Skip to content

Instantly share code, notes, and snippets.

View devshark's full-sized avatar
🎯
Focusing

Anthony devshark

🎯
Focusing
View GitHub Profile
@devshark
devshark / Array.prototype.equals.js
Last active October 29, 2018 16:36
Higad - a batang 90s game. #NokiaForever
/*
* Reference: https://stackoverflow.com/questions/7837456/how-to-compare-arrays-in-javascript/14853974
*/
// Warn if overriding existing method
if(Array.prototype.equals)
console.warn("Overriding existing Array.prototype.equals. Possible causes: New API defines the method, there's a framework conflict or you've got double inclusions in your code.");
// attach the .equals method to Array's prototype to call it on any array
Array.prototype.equals = function (array) {
// if the other array is a falsy value, return
@devshark
devshark / is-private-mode.js
Created May 20, 2019 02:26 — forked from jherax/is-private-mode.js
Detect if the browser is running in Private mode
// uncomment if you are transpiling with Babel + Webpack
// const { window, document } = global;
/**
* Lightweight script to detect whether the browser is running in Private mode.
*
* You should use a polyfill for Promise.
* @see https://ourcodeworld.com/articles/read/316/top-5-best-javascript-promises-polyfills
*
* @returns {Promise}