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
/** | |
* URI Query Parse | |
* | |
* By Will Squire <will_squire@hotmail.co.uk> | |
*/ | |
/** | |
* Parses uri query string into a key/value | |
* array. | |
* |
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
<?php | |
/** | |
* Base interface for PHP HTML elements | |
* | |
* Interface HtmlElement | |
*/ | |
interface HtmlElement { | |
/** |
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
/** | |
* Checks if a variable is empty or not. | |
* @author Will Squire <will_squire@hotmail.co.uk> | |
* | |
* @param $value | |
* @returns {boolean} | |
*/ | |
export function empty($value) { | |
return ($value === null || $value === '' || typeof $value === 'undefined'); | |
} |
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
/** | |
* Flatten a multidimensional array. | |
* | |
* @param {Array.<T>} multidimentionalArray | |
* @returns {Array.<T>} | |
*/ | |
function flattenArray(multidimentionalArray) { | |
return [].concat.apply([], multidimentionalArray); | |
} |
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
/** | |
* Checks if a value is in the range (inbetween) the | |
* value of a and b. Will also return true if equal to | |
* either value. | |
* | |
* @param {number} value | |
* @param {number} a | |
* @param {number} b | |
* @returns {boolean} | |
*/ |
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
/** | |
* Finds the difference between two numbers. | |
* | |
* @param {number} a | |
* @param {number} b | |
* @returns {number} | |
*/ | |
function difference(a, b) { | |
return Math.abs(a-b); | |
} |
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
/** | |
* Retrieves the file extension from a string. | |
* | |
* @param {string} filename | |
* @returns {string} | |
*/ | |
function fileExtension(filename) { | |
return filename.substr(filename.lastIndexOf('.') + 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
/** | |
* Linear interpolation (LERP). | |
* | |
* Returns a value between value a to value b over t (0 to 1). | |
* | |
* @param {number} a | |
* @param {number} b | |
* @param {number} t | |
* @returns {number} | |
*/ |
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
/** | |
* Time, a singleton for getting current time and delta time. | |
* I.e. Time.time or Time.deltaTime | |
* | |
* @returns {*} | |
* @constructor | |
*/ | |
var Time = function() { | |
// Singleton is returned if avalible else it is made. | |
if (Time.prototype._singletonInstance) |
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
/** | |
* Clamps a value to within the min or max values given. | |
* | |
* @param {number} value | |
* @param {number} min | |
* @param {number} max | |
* @returns {number} | |
*/ | |
function clamp(value, min, max) { | |
return Math.min(Math.max(value, min), max); |
OlderNewer