This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// prevent non-floating points from being typed | |
// pressed key must either be a number, | |
// or a decimal point (only if one has not already been typed) | |
// or a negative sign (only we are at the start of the input) | |
// USAGE: | |
// <input type="text" onkeypress="return isFloatingPoint(event);" /> | |
function isFloatingPoint(evt) | |
{ | |
var nochars = evt.currentTarget.value.trim().length == 0; | |
var alreadyHasDecimal = evt.currentTarget.value.indexOf(".") >= 0; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function inactivityTimeout( | |
timeoutWarningMinutes, | |
timeoutLogoutMinutes, | |
contentID, | |
warningCallback, | |
kickedOffCallback) { | |
// the # of seconds before we warn the user of inactivity... | |
this.timeoutWarningSeconds = timeoutWarningMinutes * 60; | |
// the # of seconds we wait after the inactivity warning to log the user out... | |
this.timeoutLogoutSeconds = timeoutLogoutMinutes * 60; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const colors = { | |
aliceblue: "#f0f8ff", | |
antiquewhite: "#faebd7", | |
aqua: "#00ffff", | |
aquamarine: "#7fffd4", | |
azure: "#f0ffff", | |
beige: "#f5f5dc", | |
bisque: "#ffe4c4", | |
black: "#000000", | |
blanchedalmond: "#ffebcd", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* canvas-toBlob-polyfill.js | |
* A canvas.toBlob() implementation. | |
*/ | |
(function(view) { | |
"use strict"; | |
var | |
Uint8Array = view.Uint8Array | |
, HTMLCanvasElement = view.HTMLCanvasElement | |
, canvas_proto = HTMLCanvasElement && HTMLCanvasElement.prototype |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (Array.prototype.forEach != undefined) { | |
// Array->forEach exists... no polyfill necessary | |
console.log("Array->forEach exists. No PolyFill necessary!"); | |
} else { | |
// Array->forEach does not exist... polyfill necessary | |
console.log("Array->forEach does not exist. Resorting to PolyFill!"); | |
Array.prototype.forEach = function(callback, thisArg) { | |
if (typeof(callback) !== 'function') { | |
throw new TypeError(callback + ' is not a function!'); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 2018.12.03 Atienza, Chris | |
// Given a slash specified network (ie: 10.1.1.1/24) returns the low and hi IPs in the defined range | |
// does not exclude any special reserved addresses | |
function _cidrToRange(cidr) { | |
var range = [2]; | |
cidr = cidr.split('/'); | |
var cidr_1 = parseInt(cidr[1]) | |
range[0] = long2ip((ip2long(cidr[0])) & ((-1 << (32 - cidr_1)))); | |
start = ip2long(range[0]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function CreateProperty(O, P, Getter, Setter) { | |
Object.defineProperty(O, P, { | |
get: Getter, | |
set: Setter | |
}); | |
} // CreateProperty | |
// SAMPLE USAGE | |
/* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This JS file implements a selector that mimics the JQUERY selector '$' | |
// identical usage. It caches selectors for speed. If there is dynamic html | |
// you can call $clearElementCache to clear a specific entry in the cache | |
// or the entire cache structure. | |
// In addition to $ we have $1 which returns the first item found | |
var __cache_Elements = []; | |
function $(selector, context) { | |
if (!__cache_Elements.hasOwnProperty(selector)) { | |
__cache_Elements[selector] = (context || document).querySelectorAll(selector); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function /* CLASS */ fileutil() { | |
// this is a static class - no need to instantiate - just call its static/shared methods... | |
}; /* CLASS fileutil */ | |
fileutil.filecontenttypes = { | |
text_plain: 'text/plain', | |
text_css: 'text/css', | |
text_csv: 'text/csv', | |
text_html: 'text/html', | |
image_bmp: 'image/bmp', |
NewerOlder