View isPrototype.js
/**
* Determines if an object is a prototype object or not.
* @param {*} obj
* Object to check to see if it is a prototype.
* @returns {boolean}
* If `obj` is a prototype object `true` is returned, otherwise `false`.
*/
function isPrototype(obj) {
var c = obj && obj.constructor;
return (c && 'function' === typeof c) ? c.prototype === obj : false;
View getStub.es6.js
/**
* Gets a stub string based on the given prefix and the time while limiting the
* stub's length.
* @param {string} prefix
* Prefix to start the stub with. This prefix may be cut short to accomodate
* for the time part of the string.
* @param {number=} opt_maxLength
* Defaults to 15. The maximum length of the returned stub.
* @param {string=} opt_chars
* Defaults to the characters A to Z followed by the characters a to z
View randomString.es6.js
function randomString(length, opt_chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz') {
return [...Array(length)].map(_ => opt_chars[~~(Math.random() * opt_chars.length)]).join('');
}
View log(x, opt_base).js
var log;
(function(CACHE_LOG_INVERSE_BASE) {
log = function(x, opt_base) {
opt_base = opt_base || Math.E;
return Math.log(x)
* (
CACHE_LOG_INVERSE_BASE[opt_base] = CACHE_LOG_INVERSE_BASE.hasOwnProperty(opt_base)
? CACHE_LOG_INVERSE_BASE[opt_base]
: (5 / Math.log(Math.pow(opt_base, 5)))
);
View suffixFileSize.js
/**
* Used to make a file size human readable. Takes the number of bytes or bits
* and converts it into a string indicating the number in the appropriate
* range (eg. KB, MB, etc.).
* @name suffixFileSize
* @function
* @param {number} count
* Number of bytes or bits to represent as a string.
* @param {boolean} [opt_countInBits=false]
* Specifies whether `count` is given in bits instead of bytes.
View compareFileNames.js
function compareFileNames(a, b) {
if (a && b) {
var aParts = (a + '').match(/\d+|\D+/g) || [],
bParts = (b + '').match(/\d+|\D+/g) || [];
if (/\d/.test(aParts[0]) == /\d/.test(bParts[0])) {
for (var x, i = 0, l = Math.min(aParts.length, bParts.length); i < l; i++) {
if (aParts[i] != bParts[i]) {
return (/\d/.test(aParts[i]) && (x = parseInt(aParts[i], 10) - parseInt(bParts[i], 10)))
? x
: aParts[i] < bParts[i] ? -1 : 1;
View isPowerOf.js
/**
* @preserve isPowerOf() by Chris West
* http://cwestblog.com/2018/03/20/javascript-snippet-ispowerof-x-base/
*
* Determines if one number (x) is an even power of a given base.
* @name isPowerOf
* @function
* @param {number} x
* Number that could be the result of multiplying or dividing base
* by itself a certain number of times.
View gsheets-search-engine.html
<!DOCTYPE html>
<html>
<head>
<title>Custom Search Engine Using Google Sheets</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.3/js/bootstrap.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.3/vue.min.js"></script>
<script type="text/javascript">
View uniqChars.js
/**
* Gets a copy of the string with all duplicate characters removed.
* @name uniqChars
* @function
* @param {string} str
* Input string which will be duplicated and whose duplicate characters will
* be removed.
* @returns {string}
* A copy of `str` with all duplicate characters removed.
*/
View IsFullOf.js
function isFullOf(arr, tester, opt_emptyIsTrue)