Permalink
Browse files

serverside tweaks.

  • Loading branch information...
1 parent 6898611 commit aae94b7d04c2e7249cc6408c632c74843c24d684 @ivarvong committed Apr 1, 2012
Showing with 39,083 additions and 17 deletions.
  1. +2 −0 .gitignore
  2. +6 −8 app.js
  3. +8 −9 index.html
  4. +5 −0 node_modules/mongodb/.travis.yml
  5. +71 −0 node_modules/mongodb/Makefile
  6. +45 −0 node_modules/mongodb/external-libs/bson/Makefile
  7. +2,165 −0 node_modules/mongodb/external-libs/bson/bson.cc
  8. +105 −0 node_modules/mongodb/external-libs/bson/bson.h
  9. +20 −0 node_modules/mongodb/external-libs/bson/index.js
  10. +349 −0 node_modules/mongodb/external-libs/bson/test/test_bson.js
  11. +218 −0 node_modules/mongodb/external-libs/bson/test/test_full_bson.js
  12. +132 −0 node_modules/mongodb/external-libs/bson/test/test_stackless_bson.js
  13. +39 −0 node_modules/mongodb/external-libs/bson/wscript
  14. +1 −0 node_modules/mongodb/index.js
  15. +40 −0 node_modules/mongodb/install.js
  16. +390 −0 node_modules/mongodb/lib/mongodb/admin.js
  17. +1,504 −0 node_modules/mongodb/lib/mongodb/collection.js
  18. +27 −0 node_modules/mongodb/lib/mongodb/commands/base_command.js
  19. +205 −0 node_modules/mongodb/lib/mongodb/commands/db_command.js
  20. +111 −0 node_modules/mongodb/lib/mongodb/commands/delete_command.js
  21. +83 −0 node_modules/mongodb/lib/mongodb/commands/get_more_command.js
  22. +141 −0 node_modules/mongodb/lib/mongodb/commands/insert_command.js
  23. +98 −0 node_modules/mongodb/lib/mongodb/commands/kill_cursor_command.js
  24. +209 −0 node_modules/mongodb/lib/mongodb/commands/query_command.js
  25. +174 −0 node_modules/mongodb/lib/mongodb/commands/update_command.js
  26. +414 −0 node_modules/mongodb/lib/mongodb/connection/connection.js
  27. +259 −0 node_modules/mongodb/lib/mongodb/connection/connection_pool.js
  28. +23 −0 node_modules/mongodb/lib/mongodb/connection/connection_utils.js
  29. +972 −0 node_modules/mongodb/lib/mongodb/connection/repl_set_servers.js
  30. +640 −0 node_modules/mongodb/lib/mongodb/connection/server.js
  31. +125 −0 node_modules/mongodb/lib/mongodb/connection/strategies/ping_strategy.js
  32. +40 −0 node_modules/mongodb/lib/mongodb/connection/strategies/statistics_strategy.js
  33. +702 −0 node_modules/mongodb/lib/mongodb/cursor.js
  34. +141 −0 node_modules/mongodb/lib/mongodb/cursorstream.js
  35. +1,788 −0 node_modules/mongodb/lib/mongodb/db.js
  36. +208 −0 node_modules/mongodb/lib/mongodb/gridfs/chunk.js
  37. +98 −0 node_modules/mongodb/lib/mongodb/gridfs/grid.js
  38. +1,109 −0 node_modules/mongodb/lib/mongodb/gridfs/gridstore.js
  39. +179 −0 node_modules/mongodb/lib/mongodb/gridfs/readstream.js
  40. +142 −0 node_modules/mongodb/lib/mongodb/index.js
  41. +131 −0 node_modules/mongodb/lib/mongodb/responses/mongo_reply.js
  42. +74 −0 node_modules/mongodb/lib/mongodb/utils.js
  43. +5 −0 node_modules/mongodb/node_modules/bson/.travis.yml
  44. +31 −0 node_modules/mongodb/node_modules/bson/Makefile
  45. 0 node_modules/mongodb/node_modules/bson/README
  46. +9 −0 node_modules/mongodb/node_modules/bson/ext/.lock-wscript
  47. +28 −0 node_modules/mongodb/node_modules/bson/ext/Makefile
  48. +2,165 −0 node_modules/mongodb/node_modules/bson/ext/bson.cc
  49. +105 −0 node_modules/mongodb/node_modules/bson/ext/bson.h
  50. BIN node_modules/mongodb/node_modules/bson/ext/bson.node
  51. BIN node_modules/mongodb/node_modules/bson/ext/build/.wafpickle-7
  52. BIN node_modules/mongodb/node_modules/bson/ext/build/Release/bson.node
  53. BIN node_modules/mongodb/node_modules/bson/ext/build/Release/bson_1.o
  54. +49 −0 node_modules/mongodb/node_modules/bson/ext/build/c4che/Release.cache.py
  55. +2 −0 node_modules/mongodb/node_modules/bson/ext/build/c4che/build.config.py
  56. +36 −0 node_modules/mongodb/node_modules/bson/ext/build/config.log
  57. +20 −0 node_modules/mongodb/node_modules/bson/ext/index.js
  58. +39 −0 node_modules/mongodb/node_modules/bson/ext/wscript
  59. +41 −0 node_modules/mongodb/node_modules/bson/install.js
  60. +336 −0 node_modules/mongodb/node_modules/bson/lib/bson/binary.js
  61. +387 −0 node_modules/mongodb/node_modules/bson/lib/bson/binary_parser.js
  62. +1,483 −0 node_modules/mongodb/node_modules/bson/lib/bson/bson.js
  63. +27 −0 node_modules/mongodb/node_modules/bson/lib/bson/code.js
  64. +33 −0 node_modules/mongodb/node_modules/bson/lib/bson/db_ref.js
  65. +35 −0 node_modules/mongodb/node_modules/bson/lib/bson/double.js
  66. +123 −0 node_modules/mongodb/node_modules/bson/lib/bson/float_parser.js
  67. +74 −0 node_modules/mongodb/node_modules/bson/lib/bson/index.js
  68. +856 −0 node_modules/mongodb/node_modules/bson/lib/bson/long.js
  69. +15 −0 node_modules/mongodb/node_modules/bson/lib/bson/max_key.js
  70. +15 −0 node_modules/mongodb/node_modules/bson/lib/bson/min_key.js
  71. +251 −0 node_modules/mongodb/node_modules/bson/lib/bson/objectid.js
  72. +50 −0 node_modules/mongodb/node_modules/bson/lib/bson/symbol.js
  73. +855 −0 node_modules/mongodb/node_modules/bson/lib/bson/timestamp.js
  74. +55 −0 node_modules/mongodb/node_modules/bson/package.json
  75. +242 −0 node_modules/mongodb/node_modules/bson/test/browser/bson_test.js
  76. +2,034 −0 node_modules/mongodb/node_modules/bson/test/browser/nodeunit.js
  77. +13 −0 node_modules/mongodb/node_modules/bson/test/browser/suite2.js
  78. +7 −0 node_modules/mongodb/node_modules/bson/test/browser/suite3.js
  79. +30 −0 node_modules/mongodb/node_modules/bson/test/browser/test.html
  80. +240 −0 node_modules/mongodb/node_modules/bson/test/node/bson_array_test.js
  81. +459 −0 node_modules/mongodb/node_modules/bson/test/node/bson_parser_comparision_test.js
  82. +1,591 −0 node_modules/mongodb/node_modules/bson/test/node/bson_test.js
  83. +392 −0 node_modules/mongodb/node_modules/bson/test/node/bson_typed_array_test.js
  84. BIN node_modules/mongodb/node_modules/bson/test/node/data/test_gs_weird_bug.png
  85. +295 −0 node_modules/mongodb/node_modules/bson/test/node/test_full_bson.js
  86. +80 −0 node_modules/mongodb/node_modules/bson/test/node/tools/utils.js
  87. +8 −0 node_modules/mongodb/node_modules/bson/tools/gleak.js
  88. +20 −0 node_modules/mongodb/node_modules/bson/tools/jasmine-1.1.0/MIT.LICENSE
  89. +190 −0 node_modules/mongodb/node_modules/bson/tools/jasmine-1.1.0/jasmine-html.js
  90. +166 −0 node_modules/mongodb/node_modules/bson/tools/jasmine-1.1.0/jasmine.css
  91. +2,476 −0 node_modules/mongodb/node_modules/bson/tools/jasmine-1.1.0/jasmine.js
  92. BIN node_modules/mongodb/node_modules/bson/tools/jasmine-1.1.0/jasmine_favicon.png
  93. +211 −0 node_modules/mongodb/package.json
  94. +9,928 −0 node_modules/mongodb/valgrind.log
  95. +382 −0 output.log
  96. +1 −0 run.sh
View
@@ -1 +1,3 @@
credentials.js
+*.log
+
View
14 app.js
@@ -6,12 +6,12 @@
var express = require('express')
, routes = require('./routes')
- , twitter = require('./ntwitter')
+ , twitter = require('ntwitter')
, mongoskin = require('mongoskin')
, sanitize = require('validator').sanitize
, credentials = require('./credentials.js');
-var db = mongoskin.db('localhost:27017/t1?auto_reconnect=true');
+var db = mongoskin.db('localhost:27017/t1');
setInterval(function() {
var currentDate = new Date();
@@ -22,7 +22,7 @@ setInterval(function() {
db.collection('tweets1').remove({created: {$lte: thresholdDate}});
-}, 1000*60);
+}, 1000*60*5);
var t = new twitter({
consumer_key: credentials.consumer_key,
@@ -197,7 +197,7 @@ app.get('/recent/:minutes?', function(req, res){
db.collection('tweets1').find({created: {$gte: thresholdDate}}).toArray(function(err, results) {
console.log(results.length, "in", minDelay);
- res.send(results);
+ res.json(results);
});;
});
@@ -233,9 +233,7 @@ app.get('/mapreduce/:targetfield?/:minutes?', function(req, res) {
if (typeof targetObject == 'object') {
targetObject.forEach(function(tag) {
- //if (ignorelist.indexOf(tag.toLowerCase()) < 0) { //WOW! it's almost twice as fast to NOT do this check. leaving it commented out...
- emit(tag , {count: 1}); //call emit once per word/hashtag/url/whatever
- //}
+ emit(tag , {count: 1}); //call emit once per word/hashtag/url/whatever
});
}
};
@@ -251,7 +249,7 @@ app.get('/mapreduce/:targetfield?/:minutes?', function(req, res) {
db.collection('tweets1').mapReduce(mapfunc, reducefunc, {query: {created: {$gte: thresholdDate}},
- scope: {MRtargetField: targetfield, ignorelist: ignorelist},
+ scope: {MRtargetField: targetfield},
out: {replace:'tempCollection'}
}, function(err, outputcollection) {
outputcollection.find({"value.count": {$gt: 1}}).
View
@@ -23,8 +23,7 @@
<script type="text/javascript">try{Typekit.load();}catch(e){}</script>
<script>
-
- var config = {target: "textlist",
+config = {target: "textlist",
freq: "3",
scale: "1"};
@@ -43,7 +42,7 @@
function tdata(data) {
buildWords("data", data);
- //$("#east").masonry('reload');
+
$("#data").masonry('reload');
}
@@ -54,11 +53,11 @@
setInterval(function() {
$.ajax({
- url: "http://localhost:3000/mapreduce/"+config.target+"/"+config.freq,
+ url: "http://ivarvong.com:3000/mapreduce/"+config.target+"/"+config.freq,
dataType: "script",
callback: "tdata"
});
- }, 1500);
+ }, 1000);
$('#data').masonry({
itemSelector: '.data',
@@ -68,7 +67,7 @@
$(":radio").change(function() {
config[$(this).attr("name")] = $(this).attr("value");
$.ajax({
- url: "http://localhost:3000/mapreduce/"+config.target+"/"+config.freq,
+ url: "http://www.ivarvong.com:3000/mapreduce/"+config.target+"/"+config.freq,
dataType: "script",
callback: "tdata"
});
@@ -87,7 +86,7 @@
<div style="float: left">
Let's look at...<br>
- <input type="radio" value="wordlist" name="target" id="text1" checked="yes">Statuses</input><br>
+ <input type="radio" value="textlist" name="target" id="text1" checked="yes">Statuses</input><br>
<input type="radio" value="hashtags" name="target" id="text2">Hashtags</input><br>
<input type="radio" value="urls" name="target" id="text2">URLs</input><br>
</div>
@@ -106,7 +105,7 @@
<!--<input type="radio" value="30" name="freq">30</input><br>-->
</div>
<div id="about">
- Built in Node.JS and MongoDB using the Twitter Streaming API. <br>
+ Built in Node.JS and MongoDB (map reduce!) using the Twitter Streaming API.<br>Current pulling all geotagged tweets in the US.<br>
<a href="https://github.com/ivong/TwitterWords">code on github</a>
<a href="http://ivarvong.com">made by ivar</a>
</div>
@@ -131,4 +130,4 @@
</script>
</body>
-</html>
+</html>

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
Oops, something went wrong.

0 comments on commit aae94b7

Please sign in to comment.