This file contains 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
/** RegExp.escape(STRING) | |
* Inspired by personal need and a polyfill found @ | |
* https://github.com/benjamingr/RegExp.escape | |
* Only real difference is implementation and accounting for forward slashes. | |
* | |
* @param {STRING|ARRAY} Can be multiple strings. If just one, then a string is returned. | |
* However, if multiple Strings, or an Array of Strings, are passed through, then an array is returned. | |
**/ | |
;(function() { | |
function regExpEscape() { |
This file contains 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
/* Date.prototype.add[Years|Months|Weeks|Days|Hours|Minutes|Seconds] */ | |
;(function() { | |
var methods = { | |
'addYears': function(v) { this.setFullYear(this.getFullYear() + parseFloat(v)); return this; }, | |
'addMonths': function(v) { this.setMonth(this.getMonth() + parseFloat(v)); return this; }, | |
'addWeeks': function(v) { this.addDays(7 * parseFloat(v)); return this; }, | |
'addDays': function(v) { this.setDate(this.getDate() + parseFloat(v)); return this; }, | |
'addHours': function(v) { this.setHours(this.getHours() + parseFloat(v)); return this; }, | |
'addMinutes': function(v) { this.setMinutes(this.getMinutes() + parseFloat(v)); return this; }, | |
'addSeconds': function(v) { this.setSeconds(this.getSeconds() + parseFloat(v)); return this; }, |
This file contains 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
/* winOpen() */ | |
;(function() { // alternate way to call for new window as well as maintain a list (use to winOpen.getList()) | |
var defaultSpecs = { // predefined specs filter | |
channelmode: 'channelmode=no', // yes|no|1|0 Whether or not to display the window in theater mode. Default is no. IE only | |
directories: 'directories=yes', // yes|no|1|0 Whether or not to add directory buttons. Default is yes. IE only | |
fullscreen: 'fullscreen=no', // yes|no|1|0 Whether or not to display the browser in full-screen mode. Default is no. A window in full-screen mode must also be in theater mode. IE only | |
height: 'height=100', // pixels The height of the window. Min. value is 100 | |
left: 'left=0', // pixels The left position of the window | |
location: 'location=yes', // yes|no|1|0 Whether or not to display the address field. Default is yes | |
menubar: 'menubar=yes', // yes|no|1|0 Whether or not to display the menu bar. Default is yes |
This file contains 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
/* String.prototype.matchUrl */ | |
;(function() { // quick and ez access to regex match on url string | |
function matchUrl(url) { | |
var regMatch = void 0, | |
araLabels = "url scheme authority path query fragment".split(" "), | |
regUrl = /^(([^\:\/\?\#]+)\:)?(\/\/([^\/\?\#]*))?([^\?\#]*)(\?([^\#]*))?(\#(.*))?/, | |
retVal = { | |
url: null, | |
scheme: null, authority: null, | |
path: null, query: null, |
This file contains 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() { | |
/* see also: http://jsfiddle.net/SpYk3/uUyrc/ */ | |
function joinObj() { | |
var obj = [], str = "", ret = [], | |
args = Array.prototype.slice.call(arguments, 0); | |
for (var x in args) switch (typeof args[x]) { | |
case 'object': | |
obj[x] = args[x]; | |
break; | |
case 'string': |
This file contains 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
/* String.prototype.similarTo */ | |
(function() { // compare a string to given param to see if its similar | |
// pass 2nd param true to have it check in reverse as well | |
function a(a, c) { | |
if (0 == a.length) return c.length; | |
if (0 == c.length) return a.length; | |
for (var d = [], e = 0; e <= c.length; e++) d[e] = [e]; | |
for (var f = 0; f <= a.length; f++) d[0][f] = f; | |
for (e = 1; e <= c.length; e++) | |
for (f = 1; f <= a.length; f++) c.charAt(e - 1) == a.charAt(f - 1) ? d[e][f] = d[e - 1][f - 1] : d[e][f] = Math.min(d[e - 1][f - 1] + 1, Math.min(d[e][f - 1] + 1, d[e - 1][f] + 1)); |
This file contains 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
/* String.prototype.reverse */ | |
;(function() { // Reverses a string | |
var name = "reverse"; | |
function reverse() { for (var a = "", g = this.length - 1; 0 <= g; g--) a += this[g]; return a; } | |
Object['defineProperty'] && !String.prototype.hasOwnProperty(name) | |
? Object.defineProperty(String.prototype, name, { value: reverse }) : String.prototype[name] = unique; | |
})(); |
This file contains 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
/* Array.prototype.unique */ | |
;(function() { // removes duplicaates from an array. * modifies original array | |
var name = "unique"; | |
function unique() { | |
var x = []; | |
for (var c = {}, d = [], a = 0; a < this.length; a++) { | |
var b = this[a].constructor.name, b = b + (/num|str|regex|bool/i.test(b) ? this[a] : JSON.stringify(this[a])); | |
if (b in c) x.push(a); | |
b in c || d.push(this[a]); | |
c[b] = 1; |
This file contains 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($) { | |
/* OPTIONS */ | |
var defaults = { | |
} | |
/* METHODS */ | |
/* EVENTS */ | |
This file contains 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
/* String.similarTo("compare", [BOOL (default TRUE) if do reverse check]) | |
* Credit to for base formula Andrei Mackenzie | |
* https://gist.github.com/andrei-m/982927 | |
**/ | |
;(function() { | |
function l(a, b) { | |
if(a.length == 0) return b.length; | |
if(b.length == 0) return a.length; | |
var matrix = []; | |
for(var i=0;i<=b.length;i++) matrix[i] = [i]; |