Created
May 13, 2009 17:09
-
-
Save nz/111135 to your computer and use it in GitHub Desktop.
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 growthFactor = function(totalTweets) { | |
var lowerBoundTweets = 100; | |
var lowerBoundGrowth = 1; | |
var upperBoundTweets = 200; | |
var upperBoundGrowth = 1.5; | |
var dx = upperBoundTweets - lowerBoundTweets; | |
var dy = upperBoundGrowth - lowerBoundGrowth; | |
var growth = (totalTweets - lowerBoundTweets) * (dy / dx) + lowerBoundGrowth; | |
if (growth < lowerBoundGrowth) return lowerBoundGrowth; | |
if (growth > upperBoundGrowth) return upperBoundGrowth; | |
return growth; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment