Created
August 25, 2011 14:36
-
-
Save austinbv/1170807 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
get_total = (trend, duration) -> | |
total = 0 | |
for keyword in trend.search_terms | |
url = "http://otter.topsy.com/search.json?q=#{keyword}&window=#{duration}" | |
$.when( $.getJSON(url) ).then((data) -> | |
total += data.response.total | |
) | |
console.log total | |
total |
This file contains hidden or 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
get_total = function(trend, duration) { | |
var keyword, total, url, _i, _len, _ref; | |
total = 0; | |
_ref = trend.search_terms; | |
for (_i = 0, _len = _ref.length; _i < _len; _i++) { | |
keyword = _ref[_i]; | |
url = "http://otter.topsy.com/search.json?q=" + keyword + "&window=" + duration; | |
$.when($.getJSON(url)).then(function(data) { | |
return total += data.response.total; | |
}); | |
} | |
console.log(total); | |
return total; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment