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 replace(txt) { | |
txt = txt.replace(/witnesses/gi, "dudes I know"); | |
txt = txt.replace(/allegedly/gi, "kinda probably"); | |
txt = txt.replace(/new study/gi, "tumblr post"); | |
txt = txt.replace(/rebuild/gi, "avenge"); | |
txt = txt.replace(/space/gi, "spaaace"); | |
txt = txt.replace(/google glass/gi, "virtual boy"); | |
txt = txt.replace(/smartphone/gi, "pokédex"); | |
txt = txt.replace(/electric/gi, "atomic"); | |
txt = txt.replace(/senator/gi, "elf-lord"); |
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(exports) { | |
var mod = function (databaseName, saveInterval) { | |
var self; | |
saveInterval = saveInterval || 2000; | |
databaseName = databaseName || 'unnamed'; | |
this.hasChanged = false; | |
this.store = {}; |
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
# Assume connections are sorted by date | |
# Calculate score at each month in time since the year 2005. | |
# This means you have (2014-2005) * 12 + 1 = 109 months of data | |
# Assume connection array is your sorted list of connections by date | |
# This creates an array where the value of the index is corresponds to the number of months | |
# that has passed since Jan. 2005 (arbitrary date, not much social data before then) | |
# Algorithm is upper-bounded by O(i+j), but average runtime will be more like O(max(i, j)) | |
var i = 0; # Keeps track of number of months that has passed since Jan. 2005 |