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
import time, os.path, shutil | |
# Where files are placed for auto-deletion | |
dirName = '/Users/cromano/Documents/autodelete/' | |
# Days after which files are considered old | |
daysUntilDelete = 1 | |
def deleteItem (itemName): | |
if os.path.isfile(itemName): |
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 strong (obj, propertyName, type, initValue) { | |
var propertyValue, | |
typeErrorMsg = "Property " + propertyName + " must be a " + type; | |
if (initValue !== undefined && typeof initValue !== type) { | |
throw new TypeError(typeErrorMsg); | |
} | |
propertyValue = initValue; |
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 foods = { | |
'italian' : 'pizza', | |
'mexican' : 'burrito', | |
'japanese' : 'sushi' | |
}; | |
// Normal way of iterating | |
for (var category in foods) { | |
console.log(foods[category], ' is a type of ', category, ' food.'); | |
} |
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
var testLoops = 10000; | |
(function(testLoops) { | |
console.time('Calling jQuery repeatedly'); | |
while (testLoops--) { | |
$("#test").text('foo'); | |
} | |
console.timeEnd('Calling jQuery repeatedly'); | |
// Sample result: 140.916ms | |
})(testLoops); |
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
/** | |
* @param {Object} | |
* @param {String} | |
* @returns {Boolean} | |
*/ | |
function radixTreeIncludesString(radixTree, string) { | |
var pointer = radixTree, | |
characters = string.split(''), | |
char; |