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
/** | |
* @module LevelStats | |
* @desc Contains math for determining the user's current level, taps | |
* required to reach next level and related logic. | |
*/ | |
var LevelStats = { | |
/** | |
* @var {Float} Determines the rate at which level cap requirements increase | |
*/ | |
levelCapExponent: 1.5, |
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
/** | |
* @author Cody Romano | |
* @module Util | |
* @desc Generic utility methods | |
*/ | |
(function(exports) { | |
'use strict'; | |
var Util = exports.Util = {}; |
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 hasProps(obj) { | |
var argsLen = arguments.length; | |
if (typeof obj !== 'object') return false; | |
if (argsLen <= 1) return false; | |
for (var i = 1, l = argsLen; i < l; i++) | |
if (!obj.hasOwnProperty(arguments[i])) return false; | |
return true; | |
} |
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
sadf |
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
var handleLocation = function(pos) { | |
console.log(pos.coords); // User's approximate latitude and longitude | |
console.log(pos.coords.accuracy); // Approximate accuracy in meters | |
}; | |
navigator.geolocation.getCurrentPosition(handleLocation, locError, {maximumAge:10, enableHighAccuracy: true}); |
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
/** | |
* @module RetroRecorder | |
* @author Cody Romano | |
* @desc This is just a demo to illustrate how RetroRecorder might be implemented. | |
* Please take it with a grain of salt because it's not optimized and the Speech API | |
* probably isn't the best implementation. | |
*/ | |
(function(exports) { | |
'use strict'; |
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 getMockDelay() { | |
return 1000 + (Math.random() * 4000); | |
} | |
async function getProducts() { | |
return new Promise((resolve) => { | |
var products = [ | |
{title: 'Wave Runner', category: 'sports', cost: 5000}, | |
{title: 'Mac', category: 'electronics', cost: 2000}, | |
{title: 'Toaster', category: 'kitchen', cost: 10}, |
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
/** | |
* @desc Convert an array of strings to a radix tree | |
* | |
* @param {Array} | |
* @returns {Object} | |
*/ | |
function radixTree(stringArray) { | |
return stringArray.reduce(function(result, string) { | |
var characters = string.split(''), | |
pointer = result; |
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
/** | |
* @desc Convert an array of strings to a radix tree | |
* @param {Array} | |
* @returns {Object} | |
*/ | |
function radixTree(stringArray) { | |
return stringArray.reduce(function(result, string) { | |
var characters = string.split(''), | |
pointer = result; |
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
/** | |
* @param {Object} | |
* @param {String} | |
* @returns {Boolean} | |
*/ | |
function radixTreeIncludesString(radixTree, string) { | |
var pointer = radixTree, | |
characters = string.split(''), | |
char; |