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
/** | |
* For convenience's sake (and to avoid all those '\\\' strings), this can be used to create new regular expression objects | |
* from any strings or existing RegExp objects input via simple concatenation. | |
* @param {string[]|RegExp[]} args - any number of strings or regular expressions | |
* @param {string} [flags] - optional flags | |
* @returns {RegExp} | |
*/ | |
function compileRegExp( args, flags = '' ) { | |
const src = args.map( arg => { | |
if ( arg instanceof RegExp ) return arg.source; |
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
/** | |
* @name browserDetect | |
* @description | |
* Parses the User Agent string to determine browser and version information, as applicable. Reliably detects major | |
* versions of the following: | |
* * Chrome | |
* * Internet Explorer | |
* * Edge | |
* * Safari | |
* * Firefox |
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
<!doctype html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Speech Synthesis in JavaScript</title> | |
<style> | |
label { | |
display: block; | |
margin-bottom: 0.5em; |
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
/** | |
* Introspect - Enumerates the closely-held properties of a given object in the browser console. | |
* | |
* Particularly useful for introspecting into DOM elements to see what the browser has tacked on. | |
* | |
* @author Steven Wiggins | |
* @date 7/8/2014 | |
* @version 0.1 | |
*/ | |
; (function() { |
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
/** | |
* Extends the primitive Array with a random sort function | |
* | |
* @returns {Array} | |
*/ | |
;Array.prototype.shuffle = function() { | |
var arr = this, | |
m = arr.length, | |
t, |
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
/** | |
* Object Size - a simple utility function for returning the length of an associative array (i.e. object) | |
* | |
* Counts the first-level direct child properties of the object and returns the count | |
* | |
* @author Steven Wiggins | |
* @date 2/4/2014 | |
* @version 0.2 | |
*/ | |
;(function() { |
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
/** | |
* Keyring - a quick polyfilled solution for getting object keys as an (optionally multidimensional) array. | |
* | |
* Accepts an optional argument to recurse into and retrieve the keys of child objects as objects in the | |
* { obj: KEYNAME, keys: [KEYS] } format. | |
* | |
* @author Steven Wiggins | |
* @date 1/17/2014 | |
* @version 0.2.2 | |
**/ |