Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

all the examples

  • Loading branch information...
commit 7a80afa6993afdeb78f45dccb2f2f53d230a4f70 0 parents
@substack authored
Showing with 43,143 additions and 0 deletions.
  1. +6 −0 JSONStream/000_title.js
  2. +1 −0  JSONStream/005.js
  3. +3 −0  JSONStream/010.js
  4. +3 −0  JSONStream/020.js
  5. +3 −0  JSONStream/030.js
  6. +3 −0  JSONStream/040.js
  7. +3 −0  JSONStream/050.js
  8. +7 −0 JSONStream/060.js
  9. +10 −0 JSONStream/070.js
  10. +10 −0 JSONStream/080.js
  11. +2 −0  JSONStream/090.js
  12. +7 −0 JSONStream/100.js
  13. +11 −0 JSONStream/110.js
  14. +8 −0 JSONStream/120_html.js
  15. +5 −0 JSONStream/130.js
  16. +12 −0 JSONStream/140.js
  17. +12 −0 JSONStream/150.js
  18. +14 −0 JSONStream/160.js
  19. +15 −0 JSONStream/170.js
  20. +2 −0  JSONStream/run1.sh
  21. +3 −0  JSONStream/run2.sh
  22. +6 −0 JSONStream/run3.sh
  23. +6 −0 JSONStream/run4.sh
  24. +6 −0 JSONStream/run5.sh
  25. +300 −0 JSONStream/static/bundle.js
  26. +5 −0 JSONStream/static/index.html
  27. +7 −0 ast/000_title.js
  28. +5 −0 ast/010_transform.js
  29. +10 −0 ast/020_transform.js
  30. +14 −0 ast/030_transform.js
  31. +14 −0 ast/040_transform.js
  32. +5 −0 ast/050_server.js
  33. +20 −0 ast/060_transform.js
  34. +7 −0 ast/run1.sh
  35. +7 −0 ast/run2.sh
  36. +4,081 −0 ast/static/bundle.js
  37. +7 −0 ast/static/index.html
  38. +15 −0 ast/transform.js
  39. +5 −0 bundle/000_foo.js
  40. +5 −0 bundle/010_main.js
  41. +5 −0 bundle/020_files/foo.js
  42. +5 −0 bundle/020_files/main.js
  43. +4 −0 bundle/020_server.js
  44. +5 −0 bundle/030_files/foo.js
  45. +5 −0 bundle/030_files/main.js
  46. +5 −0 bundle/030_main.js
  47. +7 −0 bundle/040_files/foo.js
  48. +5 −0 bundle/040_files/main.js
  49. +7 −0 bundle/040_foo.js
  50. +5 −0 bundle/run1.sh
  51. +3 −0  bundle/run2.sh
  52. +5 −0 bundle/run3.sh
  53. +406 −0 bundle/static/bundle.js
  54. +7 −0 bundle/static/index.html
  55. +5 −0 dnode_shoe/000_title.js
  56. +5 −0 dnode_shoe/010_server.js
  57. +10 −0 dnode_shoe/020_server.js
  58. +11 −0 dnode_shoe/030_server.js
  59. +16 −0 dnode_shoe/040_server.js
  60. +19 −0 dnode_shoe/050_server.js
  61. +2 −0  dnode_shoe/110_client.js
  62. +6 −0 dnode_shoe/120_client.js
  63. +9 −0 dnode_shoe/130_client.js
  64. +11 −0 dnode_shoe/140_client.js
  65. +13 −0 dnode_shoe/150_client.js
  66. +7 −0 dnode_shoe/run1.sh
  67. +4,579 −0 dnode_shoe/static/bundle.js
  68. +5 −0 dnode_shoe/static/index.html
  69. +7 −0 emit-stream/000_title.js
  70. +2 −0  emit-stream/005.js
  71. +5 −0 emit-stream/010.js
  72. +9 −0 emit-stream/020.js
  73. +11 −0 emit-stream/030.js
  74. +12 −0 emit-stream/040.js
  75. +14 −0 emit-stream/050.js
  76. +14 −0 emit-stream/060.js
  77. +23 −0 emit-stream/070.js
  78. +5 −0 emit-stream/080_client.js
  79. +4 −0 emit-stream/090_client.js
  80. +5 −0 emit-stream/100_client.js
  81. +6 −0 emit-stream/110_client.js
  82. +12 −0 emit-stream/120_client.js
  83. +14 −0 emit-stream/130_browser.js
  84. +3 −0  emit-stream/run1.sh
  85. +4 −0 emit-stream/run2.sh
  86. +7 −0 emit-stream/run3.sh
  87. +7 −0 emit-stream/run4.sh
  88. +7 −0 emit-stream/run5.sh
  89. +4,368 −0 emit-stream/static/bundle.js
  90. +5 −0 emit-stream/static/index.html
  91. +9 −0 order.txt
  92. +7 −0 roll_your_own_socketio/000_title.js
  93. +4 −0 roll_your_own_socketio/001_server.js
  94. +1 −0  roll_your_own_socketio/005_server.js
  95. +6 −0 roll_your_own_socketio/010_server.js
  96. +12 −0 roll_your_own_socketio/020_server.js
  97. +15 −0 roll_your_own_socketio/030_server.js
  98. +1 −0  roll_your_own_socketio/040_browser.js
  99. +2 −0  roll_your_own_socketio/050_browser.js
  100. +8 −0 roll_your_own_socketio/060_browser.js
  101. +16 −0 roll_your_own_socketio/070_server.js
  102. +18 −0 roll_your_own_socketio/080_server.js
  103. +18 −0 roll_your_own_socketio/090_server.js
  104. +20 −0 roll_your_own_socketio/100_server.js
  105. +22 −0 roll_your_own_socketio/110_server.js
  106. +24 −0 roll_your_own_socketio/120_server.js
  107. +33 −0 roll_your_own_socketio/130_server.js
  108. +7 −0 roll_your_own_socketio/140_browser.js
  109. +9 −0 roll_your_own_socketio/150_browser.js
  110. +10 −0 roll_your_own_socketio/160_browser.js
  111. +10 −0 roll_your_own_socketio/170_browser.js
  112. +15 −0 roll_your_own_socketio/180_browser.js
  113. +21 −0 roll_your_own_socketio/190_browser.js
  114. +2 −0  roll_your_own_socketio/node_modules/JSONStream/.npmignore
  115. +4 −0 roll_your_own_socketio/node_modules/JSONStream/.travis.yml
  116. +15 −0 roll_your_own_socketio/node_modules/JSONStream/LICENSE.APACHE2
  117. +24 −0 roll_your_own_socketio/node_modules/JSONStream/LICENSE.MIT
  118. +13 −0 roll_your_own_socketio/node_modules/JSONStream/examples/all_docs.js
  119. +171 −0 roll_your_own_socketio/node_modules/JSONStream/index.js
  120. +414 −0 roll_your_own_socketio/node_modules/JSONStream/node_modules/jsonparse/jsonparse.js
  121. +25 −0 roll_your_own_socketio/node_modules/JSONStream/node_modules/jsonparse/package.json
  122. +35 −0 roll_your_own_socketio/node_modules/JSONStream/package.json
  123. +145 −0 roll_your_own_socketio/node_modules/JSONStream/readme.markdown
  124. +41 −0 roll_your_own_socketio/node_modules/JSONStream/test/bool.js
  125. +4,030 −0 roll_your_own_socketio/node_modules/JSONStream/test/fixtures/all_npm.json
  126. +39 −0 roll_your_own_socketio/node_modules/JSONStream/test/fn.js
  127. +28 −0 roll_your_own_socketio/node_modules/JSONStream/test/parsejson.js
  128. +41 −0 roll_your_own_socketio/node_modules/JSONStream/test/stringify.js
  129. +47 −0 roll_your_own_socketio/node_modules/JSONStream/test/stringify_object.js
  130. +35 −0 roll_your_own_socketio/node_modules/JSONStream/test/test.js
  131. +29 −0 roll_your_own_socketio/node_modules/JSONStream/test/test2.js
  132. +41 −0 roll_your_own_socketio/node_modules/JSONStream/test/two-ways.js
  133. +82 −0 roll_your_own_socketio/node_modules/ecstatic/README.md
  134. +6 −0 roll_your_own_socketio/node_modules/ecstatic/example/core.js
  135. +8 −0 roll_your_own_socketio/node_modules/ecstatic/example/express.js
  136. +1 −0  roll_your_own_socketio/node_modules/ecstatic/example/public/beep/index.html
  137. +1 −0  roll_your_own_socketio/node_modules/ecstatic/example/public/hello.txt
  138. +1 −0  roll_your_own_socketio/node_modules/ecstatic/example/public/subdir/world.txt
  139. BIN  roll_your_own_socketio/node_modules/ecstatic/example/public/turtle.png
  140. +10 −0 roll_your_own_socketio/node_modules/ecstatic/example/union.js
  141. +132 −0 roll_your_own_socketio/node_modules/ecstatic/lib/ecstatic.js
  142. +3 −0  roll_your_own_socketio/node_modules/ecstatic/lib/ecstatic/etag.js
  143. +22 −0 roll_your_own_socketio/node_modules/ecstatic/lib/ecstatic/opts.js
  144. +113 −0 roll_your_own_socketio/node_modules/ecstatic/lib/ecstatic/showdir.js
  145. +47 −0 roll_your_own_socketio/node_modules/ecstatic/lib/ecstatic/status-handlers.js
  146. +19 −0 roll_your_own_socketio/node_modules/ecstatic/lib/templates/showdir.html
  147. +1 −0  roll_your_own_socketio/node_modules/ecstatic/node_modules/ent/.npmignore
  148. +35 −0 roll_your_own_socketio/node_modules/ecstatic/node_modules/ent/README.markdown
  149. +255 −0 roll_your_own_socketio/node_modules/ecstatic/node_modules/ent/entities.json
  150. +3 −0  roll_your_own_socketio/node_modules/ecstatic/node_modules/ent/examples/simple.js
  151. +65 −0 roll_your_own_socketio/node_modules/ecstatic/node_modules/ent/index.js
  152. +33 −0 roll_your_own_socketio/node_modules/ecstatic/node_modules/ent/package.json
  153. +56 −0 roll_your_own_socketio/node_modules/ecstatic/node_modules/ent/test/codes.js
  154. +19 −0 roll_your_own_socketio/node_modules/ecstatic/node_modules/mime/LICENSE
  155. +63 −0 roll_your_own_socketio/node_modules/ecstatic/node_modules/mime/README.md
  156. +93 −0 roll_your_own_socketio/node_modules/ecstatic/node_modules/mime/mime.js
  157. +31 −0 roll_your_own_socketio/node_modules/ecstatic/node_modules/mime/package.json
  158. +53 −0 roll_your_own_socketio/node_modules/ecstatic/node_modules/mime/test.js
  159. +1,510 −0 roll_your_own_socketio/node_modules/ecstatic/node_modules/mime/types/mime.types
  160. +48 −0 roll_your_own_socketio/node_modules/ecstatic/node_modules/mime/types/node.types
  161. +43 −0 roll_your_own_socketio/node_modules/ecstatic/package.json
  162. +85 −0 roll_your_own_socketio/node_modules/ecstatic/test/express.js
  163. +1 −0  roll_your_own_socketio/node_modules/ecstatic/test/express/a.txt
  164. +1 −0  roll_your_own_socketio/node_modules/ecstatic/test/express/b.txt
  165. +1 −0  roll_your_own_socketio/node_modules/ecstatic/test/express/c.js
  166. +1 −0  roll_your_own_socketio/node_modules/ecstatic/test/express/subdir/e.html
  167. +1 −0  roll_your_own_socketio/node_modules/ecstatic/test/express/subdir/index.html
  168. +4 −0 roll_your_own_socketio/node_modules/emit-stream/.travis.yml
  169. +18 −0 roll_your_own_socketio/node_modules/emit-stream/LICENSE
  170. +16 −0 roll_your_own_socketio/node_modules/emit-stream/example/client-server/client.js
  171. +30 −0 roll_your_own_socketio/node_modules/emit-stream/example/client-server/server.js
  172. +45 −0 roll_your_own_socketio/node_modules/emit-stream/example/emit.js
  173. +49 −0 roll_your_own_socketio/node_modules/emit-stream/index.js
  174. +41 −0 roll_your_own_socketio/node_modules/emit-stream/package.json
  175. +117 −0 roll_your_own_socketio/node_modules/emit-stream/readme.markdown
  176. +73 −0 roll_your_own_socketio/node_modules/emit-stream/test/emit.js
  177. +1 −0  roll_your_own_socketio/node_modules/shoe/.npmignore
  178. +18 −0 roll_your_own_socketio/node_modules/shoe/LICENSE
  179. +207 −0 roll_your_own_socketio/node_modules/shoe/README.markdown
  180. +66 −0 roll_your_own_socketio/node_modules/shoe/browser.js
  181. +2 −0  roll_your_own_socketio/node_modules/shoe/example/dnode/Makefile
  182. +16 −0 roll_your_own_socketio/node_modules/shoe/example/dnode/client.js
  183. +11 −0 roll_your_own_socketio/node_modules/shoe/example/dnode/package.json
  184. +19 −0 roll_your_own_socketio/node_modules/shoe/example/dnode/server.js
  185. +4,579 −0 roll_your_own_socketio/node_modules/shoe/example/dnode/static/bundle.js
  186. +2 −0  roll_your_own_socketio/node_modules/shoe/example/dnode/static/index.html
  187. +2 −0  roll_your_own_socketio/node_modules/shoe/example/invert/Makefile
  188. +14 −0 roll_your_own_socketio/node_modules/shoe/example/invert/client.js
  189. +11 −0 roll_your_own_socketio/node_modules/shoe/example/invert/package.json
  190. +19 −0 roll_your_own_socketio/node_modules/shoe/example/invert/server.js
  191. +4,103 −0 roll_your_own_socketio/node_modules/shoe/example/invert/static/bundle.js
  192. +2 −0  roll_your_own_socketio/node_modules/shoe/example/invert/static/index.html
  193. +36 −0 roll_your_own_socketio/node_modules/shoe/index.js
  194. +3 −0  roll_your_own_socketio/node_modules/shoe/node_modules/sockjs-client/.npmignore
  195. +11 −0 roll_your_own_socketio/node_modules/shoe/node_modules/sockjs-client/COPYING
  196. +128 −0 roll_your_own_socketio/node_modules/shoe/node_modules/sockjs-client/Changelog
  197. +19 −0 roll_your_own_socketio/node_modules/shoe/node_modules/sockjs-client/LICENSE-MIT-SockJS
  198. +107 −0 roll_your_own_socketio/node_modules/shoe/node_modules/sockjs-client/Makefile
  199. +379 −0 roll_your_own_socketio/node_modules/shoe/node_modules/sockjs-client/README.md
  200. +17 −0 roll_your_own_socketio/node_modules/shoe/node_modules/sockjs-client/VERSION-GEN
  201. +111 −0 roll_your_own_socketio/node_modules/shoe/node_modules/sockjs-client/bin/render.coffee
  202. +135 −0 roll_your_own_socketio/node_modules/shoe/node_modules/sockjs-client/bin/run_testling.sh
  203. +9 −0 roll_your_own_socketio/node_modules/shoe/node_modules/sockjs-client/lib/all.js
  204. +205 −0 roll_your_own_socketio/node_modules/shoe/node_modules/sockjs-client/lib/dom.js
  205. +191 −0 roll_your_own_socketio/node_modules/shoe/node_modules/sockjs-client/lib/dom2.js
  206. +31 −0 roll_your_own_socketio/node_modules/shoe/node_modules/sockjs-client/lib/eventemitter.js
  207. +41 −0 roll_your_own_socketio/node_modules/shoe/node_modules/sockjs-client/lib/index.js
  208. +114 −0 roll_your_own_socketio/node_modules/shoe/node_modules/sockjs-client/lib/info.js
  209. +1 −0  roll_your_own_socketio/node_modules/shoe/node_modules/sockjs-client/lib/json2.min.js
  210. +55 −0 roll_your_own_socketio/node_modules/shoe/node_modules/sockjs-client/lib/reventtarget.js
  211. +28 −0 roll_your_own_socketio/node_modules/shoe/node_modules/sockjs-client/lib/simpleevent.js
  212. +261 −0 roll_your_own_socketio/node_modules/shoe/node_modules/sockjs-client/lib/sockjs.js
  213. +16 −0 roll_your_own_socketio/node_modules/shoe/node_modules/sockjs-client/lib/test-hooks.js
  214. +29 −0 roll_your_own_socketio/node_modules/shoe/node_modules/sockjs-client/lib/trans-iframe-eventsource.js
  215. +35 −0 roll_your_own_socketio/node_modules/shoe/node_modules/sockjs-client/lib/trans-iframe-htmlfile.js
  216. +94 −0 roll_your_own_socketio/node_modules/shoe/node_modules/sockjs-client/lib/trans-iframe-within.js
  217. +30 −0 roll_your_own_socketio/node_modules/shoe/node_modules/sockjs-client/lib/trans-iframe-xhr-polling.js
  218. +93 −0 roll_your_own_socketio/node_modules/shoe/node_modules/sockjs-client/lib/trans-iframe.js
  219. +85 −0 roll_your_own_socketio/node_modules/shoe/node_modules/sockjs-client/lib/trans-jsonp-polling.js
  220. +114 −0 roll_your_own_socketio/node_modules/shoe/node_modules/sockjs-client/lib/trans-jsonp-receiver.js
  221. +44 −0 roll_your_own_socketio/node_modules/shoe/node_modules/sockjs-client/lib/trans-polling.js
  222. +41 −0 roll_your_own_socketio/node_modules/shoe/node_modules/sockjs-client/lib/trans-receiver-eventsource.js
  223. +65 −0 roll_your_own_socketio/node_modules/shoe/node_modules/sockjs-client/lib/trans-receiver-htmlfile.js
  224. +42 −0 roll_your_own_socketio/node_modules/shoe/node_modules/sockjs-client/lib/trans-receiver-xhr.js
  225. +135 −0 roll_your_own_socketio/node_modules/shoe/node_modules/sockjs-client/lib/trans-sender.js
  226. +60 −0 roll_your_own_socketio/node_modules/shoe/node_modules/sockjs-client/lib/trans-websocket.js
  227. +89 −0 roll_your_own_socketio/node_modules/shoe/node_modules/sockjs-client/lib/trans-xhr.js
  228. +325 −0 roll_your_own_socketio/node_modules/shoe/node_modules/sockjs-client/lib/utils.js
  229. +30 −0 roll_your_own_socketio/node_modules/shoe/node_modules/sockjs-client/package.json
  230. +2,323 −0 roll_your_own_socketio/node_modules/shoe/node_modules/sockjs-client/sockjs.js
  231. +1 −0  roll_your_own_socketio/node_modules/shoe/node_modules/sockjs-client/version
  232. +5 −0 roll_your_own_socketio/node_modules/shoe/node_modules/sockjs-windows/.npmignore
  233. +6 −0 roll_your_own_socketio/node_modules/shoe/node_modules/sockjs-windows/COPYING
  234. +126 −0 roll_your_own_socketio/node_modules/shoe/node_modules/sockjs-windows/Changelog
  235. +19 −0 roll_your_own_socketio/node_modules/shoe/node_modules/sockjs-windows/LICENSE-MIT-SockJS
  236. +55 −0 roll_your_own_socketio/node_modules/shoe/node_modules/sockjs-windows/Makefile
  237. +429 −0 roll_your_own_socketio/node_modules/shoe/node_modules/sockjs-windows/README.md
  238. +15 −0 roll_your_own_socketio/node_modules/shoe/node_modules/sockjs-windows/examples/echo/README.md
  239. +71 −0 roll_your_own_socketio/node_modules/shoe/node_modules/sockjs-windows/examples/echo/index.html
  240. +8 −0 roll_your_own_socketio/node_modules/shoe/node_modules/sockjs-windows/examples/echo/package.json
  241. +30 −0 roll_your_own_socketio/node_modules/shoe/node_modules/sockjs-windows/examples/echo/server.js
  242. +71 −0 roll_your_own_socketio/node_modules/shoe/node_modules/sockjs-windows/examples/express-3.x/index.html
  243. +8 −0 roll_your_own_socketio/node_modules/shoe/node_modules/sockjs-windows/examples/express-3.x/package.json
  244. +26 −0 roll_your_own_socketio/node_modules/shoe/node_modules/sockjs-windows/examples/express-3.x/server.js
  245. +71 −0 roll_your_own_socketio/node_modules/shoe/node_modules/sockjs-windows/examples/express/index.html
  246. +8 −0 roll_your_own_socketio/node_modules/shoe/node_modules/sockjs-windows/examples/express/package.json
  247. +23 −0 roll_your_own_socketio/node_modules/shoe/node_modules/sockjs-windows/examples/express/server.js
  248. +42 −0 roll_your_own_socketio/node_modules/shoe/node_modules/sockjs-windows/examples/haproxy.cfg
  249. +26 −0 roll_your_own_socketio/node_modules/shoe/node_modules/sockjs-windows/examples/multiplex/README.md
  250. +96 −0 roll_your_own_socketio/node_modules/shoe/node_modules/sockjs-windows/examples/multiplex/index.html
  251. +9 −0 roll_your_own_socketio/node_modules/shoe/node_modules/sockjs-windows/examples/multiplex/package.json
  252. +52 −0 roll_your_own_socketio/node_modules/shoe/node_modules/sockjs-windows/examples/multiplex/server.js
  253. +30 −0 roll_your_own_socketio/node_modules/shoe/node_modules/sockjs-windows/examples/test_server/README.md
  254. +9 −0 roll_your_own_socketio/node_modules/shoe/node_modules/sockjs-windows/examples/test_server/config.js
  255. +7 −0 roll_your_own_socketio/node_modules/shoe/node_modules/sockjs-windows/examples/test_server/package.json
  256. +19 −0 roll_your_own_socketio/node_modules/shoe/node_modules/sockjs-windows/examples/test_server/server.js
  257. +85 −0 roll_your_own_socketio/node_modules/shoe/node_modules/sockjs-windows/examples/test_server/sockjs_app.js
  258. +1 −0  roll_your_own_socketio/node_modules/shoe/node_modules/sockjs-windows/index.js
  259. +73 −0 roll_your_own_socketio/node_modules/shoe/node_modules/sockjs-windows/lib/chunking-test.js
  260. +29 −0 roll_your_own_socketio/node_modules/shoe/node_modules/sockjs-windows/lib/iframe.js
  261. +217 −0 roll_your_own_socketio/node_modules/shoe/node_modules/sockjs-windows/lib/sockjs.js
  262. +40 −0 roll_your_own_socketio/node_modules/shoe/node_modules/sockjs-windows/lib/trans-eventsource.js
  263. +58 −0 roll_your_own_socketio/node_modules/shoe/node_modules/sockjs-windows/lib/trans-htmlfile.js
  264. +104 −0 roll_your_own_socketio/node_modules/shoe/node_modules/sockjs-windows/lib/trans-jsonp.js
  265. +207 −0 roll_your_own_socketio/node_modules/shoe/node_modules/sockjs-windows/lib/trans-websocket.js
  266. +116 −0 roll_your_own_socketio/node_modules/shoe/node_modules/sockjs-windows/lib/trans-xhr.js
  267. +372 −0 roll_your_own_socketio/node_modules/shoe/node_modules/sockjs-windows/lib/transport.js
  268. +169 −0 roll_your_own_socketio/node_modules/shoe/node_modules/sockjs-windows/lib/utils.js
  269. +283 −0 roll_your_own_socketio/node_modules/shoe/node_modules/sockjs-windows/lib/webjs.js
  270. +40 −0 roll_your_own_socketio/node_modules/shoe/node_modules/sockjs-windows/node_modules/faye-websocket/CHANGELOG.txt
  271. +248 −0 ...your_own_socketio/node_modules/shoe/node_modules/sockjs-windows/node_modules/faye-websocket/README.markdown
  272. +40 −0 ...ketio/node_modules/shoe/node_modules/sockjs-windows/node_modules/faye-websocket/examples/autobahn_client.js
  273. +22 −0 ...r_own_socketio/node_modules/shoe/node_modules/sockjs-windows/node_modules/faye-websocket/examples/client.js
  274. +21 −0 ...wn_socketio/node_modules/shoe/node_modules/sockjs-windows/node_modules/faye-websocket/examples/haproxy.conf
  275. +70 −0 ...r_own_socketio/node_modules/shoe/node_modules/sockjs-windows/node_modules/faye-websocket/examples/server.js
  276. +39 −0 ...ur_own_socketio/node_modules/shoe/node_modules/sockjs-windows/node_modules/faye-websocket/examples/sse.html
  277. +44 −0 ...our_own_socketio/node_modules/shoe/node_modules/sockjs-windows/node_modules/faye-websocket/examples/ws.html
  278. +104 −0 ..._socketio/node_modules/shoe/node_modules/sockjs-windows/node_modules/faye-websocket/lib/faye/eventsource.js
  279. +91 −0 ...wn_socketio/node_modules/shoe/node_modules/sockjs-windows/node_modules/faye-websocket/lib/faye/websocket.js
  280. +83 −0 ...ocketio/node_modules/shoe/node_modules/sockjs-windows/node_modules/faye-websocket/lib/faye/websocket/api.js
  281. +21 −0 ...o/node_modules/shoe/node_modules/sockjs-windows/node_modules/faye-websocket/lib/faye/websocket/api/event.js
  282. +47 −0 ...modules/shoe/node_modules/sockjs-windows/node_modules/faye-websocket/lib/faye/websocket/api/event_target.js
  283. +83 −0 ...etio/node_modules/shoe/node_modules/sockjs-windows/node_modules/faye-websocket/lib/faye/websocket/client.js
  284. +98 −0 ...e_modules/shoe/node_modules/sockjs-windows/node_modules/faye-websocket/lib/faye/websocket/draft75_parser.js
  285. +99 −0 ...e_modules/shoe/node_modules/sockjs-windows/node_modules/faye-websocket/lib/faye/websocket/draft76_parser.js
  286. +354 −0 ...node_modules/shoe/node_modules/sockjs-windows/node_modules/faye-websocket/lib/faye/websocket/hybi_parser.js
  287. +91 −0 ...es/shoe/node_modules/sockjs-windows/node_modules/faye-websocket/lib/faye/websocket/hybi_parser/handshake.js
  288. +43 −0 ...hoe/node_modules/sockjs-windows/node_modules/faye-websocket/lib/faye/websocket/hybi_parser/stream_reader.js
  289. +41 −0 roll_your_own_socketio/node_modules/shoe/node_modules/sockjs-windows/node_modules/faye-websocket/package.json
  290. +162 −0 ...ode_modules/shoe/node_modules/sockjs-windows/node_modules/faye-websocket/spec/faye/websocket/client_spec.js
  291. +72 −0 ...ules/shoe/node_modules/sockjs-windows/node_modules/faye-websocket/spec/faye/websocket/draft75parser_spec.js
  292. +28 −0 ...ules/shoe/node_modules/sockjs-windows/node_modules/faye-websocket/spec/faye/websocket/draft76parser_spec.js
  293. +157 −0 ...odules/shoe/node_modules/sockjs-windows/node_modules/faye-websocket/spec/faye/websocket/hybi_parser_spec.js
  294. +54 −0 ..._your_own_socketio/node_modules/shoe/node_modules/sockjs-windows/node_modules/faye-websocket/spec/runner.js
  295. +15 −0 ...your_own_socketio/node_modules/shoe/node_modules/sockjs-windows/node_modules/faye-websocket/spec/server.crt
  296. +15 −0 ...your_own_socketio/node_modules/shoe/node_modules/sockjs-windows/node_modules/faye-websocket/spec/server.key
  297. +2 −0  roll_your_own_socketio/node_modules/shoe/node_modules/sockjs-windows/node_modules/node-uuid/.npmignore
  298. +3 −0  roll_your_own_socketio/node_modules/shoe/node_modules/sockjs-windows/node_modules/node-uuid/LICENSE.md
  299. +199 −0 roll_your_own_socketio/node_modules/shoe/node_modules/sockjs-windows/node_modules/node-uuid/README.md
  300. +53 −0 ..._your_own_socketio/node_modules/shoe/node_modules/sockjs-windows/node_modules/node-uuid/benchmark/README.md
Sorry, we could not display the entire diff because too many files (390) changed.
6 JSONStream/000_title.js
@@ -0,0 +1,6 @@
+/*
+ JSONStream
+
+ - parse JSON incrementally from a stream
+
+*/
1  JSONStream/005.js
@@ -0,0 +1 @@
+var JSONStream = require('JSONStream');
3  JSONStream/010.js
@@ -0,0 +1,3 @@
+var JSONStream = require('JSONStream');
+
+var parser = JSONStream.parse([ ... ]);
3  JSONStream/020.js
@@ -0,0 +1,3 @@
+var JSONStream = require('JSONStream');
+
+var parser = JSONStream.parse([ 'features', ]);
3  JSONStream/030.js
@@ -0,0 +1,3 @@
+var JSONStream = require('JSONStream');
+
+var parser = JSONStream.parse([ 'features', true, ]);
3  JSONStream/040.js
@@ -0,0 +1,3 @@
+var JSONStream = require('JSONStream');
+
+var parser = JSONStream.parse([ 'features', true, 'geometry', ]);
3  JSONStream/050.js
@@ -0,0 +1,3 @@
+var JSONStream = require('JSONStream');
+
+var parser = JSONStream.parse([ 'features', true, 'geometry', 'coordinates' ]);
7 JSONStream/060.js
@@ -0,0 +1,7 @@
+var JSONStream = require('JSONStream');
+
+var parser = JSONStream.parse([ 'features', true, 'geometry', 'coordinates' ]);
+
+parser.on('data', function (coords) {
+ console.dir(coords);
+});
10 JSONStream/070.js
@@ -0,0 +1,10 @@
+var JSONStream = require('JSONStream');
+var fs = require('fs');
+
+var parser = JSONStream.parse([ 'features', true, 'geometry', 'coordinates' ]);
+
+parser.on('data', function (coords) {
+ console.dir(coords);
+});
+
+fs.createReadStream('citylots.json').pipe(parser);
10 JSONStream/080.js
@@ -0,0 +1,10 @@
+var JSONStream = require('JSONStream');
+var request = require('request');
+
+var parser = JSONStream.parse([ 'features', true, 'geometry', 'coordinates' ]);
+
+parser.on('data', function (coords) {
+ console.dir(coords);
+});
+
+request('http://localhost:8005').pipe(parser);
2  JSONStream/090.js
@@ -0,0 +1,2 @@
+var fs = require('fs');
+fs.createReadStream('citylots.json');
7 JSONStream/100.js
@@ -0,0 +1,7 @@
+var http = require('http');
+var fs = require('fs');
+
+var server = http.createServer(function (req, res) {
+ fs.createReadStream('citylots.json').pipe(res);
+});
+server.listen(8005);
11 JSONStream/110.js
@@ -0,0 +1,11 @@
+var http = require('http');
+var fs = require('fs');
+var ecstatic = require('ecstatic')(__dirname + '/static');
+
+var server = http.createServer(function (req, res) {
+ if (req.url === '/data') {
+ fs.createReadStream('citylots.json').pipe(res);
+ }
+ else ecstatic(req, res);
+});
+server.listen(8005);
8 JSONStream/120_html.js
@@ -0,0 +1,8 @@
+/* throw down an index.html:
+
+ <html>
+ <body>
+ <script src="bundle.js"></script>
+ </body>
+ </html>
+*/
5 JSONStream/130.js
@@ -0,0 +1,5 @@
+/*
+
+ now let's use JSONStream in the browser!
+
+*/
12 JSONStream/140.js
@@ -0,0 +1,12 @@
+// server version
+
+var JSONStream = require('JSONStream');
+var request = require('request');
+
+var parser = JSONStream.parse([ 'features', true, 'geometry', 'coordinates' ]);
+
+parser.on('data', function (coords) {
+ console.dir(coords);
+});
+
+request('http://localhost:8005/data').pipe(parser);
12 JSONStream/150.js
@@ -0,0 +1,12 @@
+// browser version
+
+var JSONStream = require('JSONStream');
+var request = require('request');
+
+var parser = JSONStream.parse([ 'features', true, 'geometry', 'coordinates' ]);
+
+parser.on('data', function (coords) {
+ console.dir(coords);
+});
+
+request('http://localhost:8005/data').pipe(parser);
14 JSONStream/160.js
@@ -0,0 +1,14 @@
+// browser version
+
+var JSONStream = require('JSONStream');
+var request = require('request');
+
+var parser = JSONStream.parse([ 'features', true, 'geometry', 'coordinates' ]);
+
+parser.on('data', function (coords) {
+ var div = document.createElement('div');
+ div.textContent = JSON.stringify(coords);
+ document.body.appendChild(div);
+});
+
+request('http://localhost:8005/data').pipe(parser);
15 JSONStream/170.js
@@ -0,0 +1,15 @@
+var http = require('http');
+var fs = require('fs');
+var ecstatic = require('ecstatic')(__dirname + '/static');
+var brake = require('brake');
+
+var server = http.createServer(function (req, res) {
+ if (req.url === '/data') {
+ fs.createReadStream('citylots.json')
+ .pipe(brake(1500))
+ .pipe(res)
+ ;
+ }
+ else ecstatic(req, res);
+});
+server.listen(8005);
2  JSONStream/run1.sh
@@ -0,0 +1,2 @@
+#!/bin/bash
+node 070.js
3  JSONStream/run2.sh
@@ -0,0 +1,3 @@
+#!/bin/bash
+echo curl -sS http://localhost:8005
+node 100.js
6 JSONStream/run3.sh
@@ -0,0 +1,6 @@
+#!/bin/bash
+echo '#' browserify 150.js -o static/bundle.js
+browserify 150.js -o static/bundle.js --debug
+
+echo '#' now visit http://localhost:8005
+node 110.js
6 JSONStream/run4.sh
@@ -0,0 +1,6 @@
+#!/bin/bash
+echo '#' browserify 160.js -o static/bundle.js
+browserify 160.js -o static/bundle.js --debug
+
+echo '#' now visit http://localhost:8005
+node 110.js
6 JSONStream/run5.sh
@@ -0,0 +1,6 @@
+#!/bin/bash
+echo '#' browserify 160.js -o static/bundle.js
+browserify 160.js -o static/bundle.js --debug
+
+echo '#' now visit http://localhost:8005
+node 170.js
300 JSONStream/static/bundle.js
300 additions, 0 deletions not shown
5 JSONStream/static/index.html
@@ -0,0 +1,5 @@
+<html>
+<body>
+<script src="bundle.js"></script>
+</body>
+</html>
7 ast/000_title.js
@@ -0,0 +1,7 @@
+/*
+
+ falafel
+
+ - walk the ast
+
+*/
5 ast/010_transform.js
@@ -0,0 +1,5 @@
+var src = '(' + function () {
+ var x = 2 + 3 * 6;
+ var y = Math.pow(x, 2);
+ console.log(x + y);
+} + ')()';
10 ast/020_transform.js
@@ -0,0 +1,10 @@
+var src = '(' + function () {
+ var x = 2 + 3 * 6;
+ var y = Math.pow(x, 2);
+ console.log(x + y);
+} + ')()';
+
+var falafel = require('falafel');
+var out = falafel(src, function (node) {
+ // ...
+});
14 ast/030_transform.js
@@ -0,0 +1,14 @@
+var src = '(' + function () {
+ var x = 2 + 3 * 6;
+ var y = Math.pow(x, 2);
+ console.log(x + y);
+} + ')()';
+
+var falafel = require('falafel');
+var out = falafel(src, function (node) {
+ // ...
+});
+
+var div = document.createElement('div');
+div.textContent = out;
+document.body.appendChild(div);
14 ast/040_transform.js
@@ -0,0 +1,14 @@
+var src = '(' + function () {
+ var x = 2 + 3 * 6;
+ var y = Math.pow(x, 2);
+ console.log(x + y);
+} + ')()';
+
+var falafel = require('falafel');
+var out = falafel(src, function (node) {
+ if (node.type === 'CallExpression') {
+ node.update('fff(' + node.source() + ')');
+ }
+});
+
+document.querySelector('pre').textContent = out;
5 ast/050_server.js
@@ -0,0 +1,5 @@
+var http = require('http');
+var ecstatic = require('ecstatic')(__dirname + '/static');
+http.createServer(ecstatic).listen(8005);
+
+// ./run1.sh
20 ast/060_transform.js
@@ -0,0 +1,20 @@
+var src = '(' + function () {
+ var x = 2 + 3 * 6;
+ var y = Math.pow(x, 2);
+ console.log(x + y);
+} + ')()';
+
+var falafel = require('falafel');
+var out = falafel(src, function (node) {
+ if (node.type === 'CallExpression') {
+ node.update('fff(' + node.source() + ')');
+ }
+});
+
+var original = false;
+setInterval(function () {
+ document.querySelector('pre').textContent = original ? src : out;
+ original = !original;
+}, 1000);
+
+// ./run2.sh
7 ast/run1.sh
@@ -0,0 +1,7 @@
+#!/bin/bash
+
+echo '#' browserify 040_transform.js -o static/bundle.js
+browserify 040_transform.js -o static/bundle.js
+
+echo http://localhost:8005
+node 050_server.js
7 ast/run2.sh
@@ -0,0 +1,7 @@
+#!/bin/bash
+
+echo '#' browserify 060_transform.js -o static/bundle.js
+browserify 060_transform.js -o static/bundle.js
+
+echo http://localhost:8005
+node 050_server.js
4,081 ast/static/bundle.js
4,081 additions, 0 deletions not shown
7 ast/static/index.html
@@ -0,0 +1,7 @@
+<html>
+<body>
+<style> pre { font-size: 72px; } </style>
+<pre></pre>
+</body>
+<script src="/bundle.js"></script>
+</html>
15 ast/transform.js
@@ -0,0 +1,15 @@
+var falafel = require('falafel');
+var src = '(' + function () {
+ var x = 2 + 3 * 6;
+ var y = Math.pow(x, 2);
+ console.log(x + y);
+} + ')()';
+
+var out = falafel(src, function (node) {
+ if (node.type === 'CallExpression') {
+ node.update('fff(' + node.source() + ')');
+ }
+});
+
+var $ = require('jquery-browserify');
+$('pre').text(out);
5 bundle/000_foo.js
@@ -0,0 +1,5 @@
+// foo.js
+
+module.exports = function (n) {
+ return n * 111;
+};
5 bundle/010_main.js
@@ -0,0 +1,5 @@
+// main.js
+
+var foo = require('./foo');
+
+document.querySelector('pre').textContent = foo(5);
5 bundle/020_files/foo.js
@@ -0,0 +1,5 @@
+// foo.js
+
+module.exports = function (n) {
+ return n * 111;
+};
5 bundle/020_files/main.js
@@ -0,0 +1,5 @@
+// main.js
+
+var foo = require('./foo');
+
+document.querySelector('pre').textContent = foo(5);
4 bundle/020_server.js
@@ -0,0 +1,4 @@
+var http = require('http');
+var ecstatic = require('ecstatic')(__dirname + '/static');
+http.createServer(ecstatic).listen(8005);
+console.log('http://localhost:8005');
5 bundle/030_files/foo.js
@@ -0,0 +1,5 @@
+// foo.js
+
+module.exports = function (n) {
+ return n * 111;
+};
5 bundle/030_files/main.js
@@ -0,0 +1,5 @@
+// main.js
+
+var foo = require('./foo');
+
+document.querySelector('pre').textContent = foo(5);
5 bundle/030_main.js
@@ -0,0 +1,5 @@
+// main.js
+
+var foo = require('./foo');
+
+document.querySelector('pre').textContent = foo(5);
7 bundle/040_files/foo.js
@@ -0,0 +1,7 @@
+// foo.js
+
+module.exports = function (n) {
+ beep.boop();
+
+ return n * 111;
+};
5 bundle/040_files/main.js
@@ -0,0 +1,5 @@
+// main.js
+
+var foo = require('./foo');
+
+document.querySelector('pre').textContent = foo(5);
7 bundle/040_foo.js
@@ -0,0 +1,7 @@
+// foo.js
+
+module.exports = function (n) {
+ beep.boop();
+
+ return n * 111;
+};
5 bundle/run1.sh
@@ -0,0 +1,5 @@
+#!/bin/bash
+echo browserify main.js -o static/bundle.js
+browserify 020_files/main.js -o static/bundle.js
+
+node 020_server.js
3  bundle/run2.sh
@@ -0,0 +1,3 @@
+#!/bin/bash
+echo '#' browserify main.js -o static/bundle.js --watch -v
+browserify 030_files/main.js -o static/bundle.js --watch -v
5 bundle/run3.sh
@@ -0,0 +1,5 @@
+#!/bin/bash
+echo browserify main.js -o static/bundle.js --debug
+browserify 040_files/main.js -o static/bundle.js --debug
+
+node 020_server.js
406 bundle/static/bundle.js
@@ -0,0 +1,406 @@
+(function(){var require = function (file, cwd) {
+ var resolved = require.resolve(file, cwd || '/');
+ var mod = require.modules[resolved];
+ if (!mod) throw new Error(
+ 'Failed to resolve module ' + file + ', tried ' + resolved
+ );
+ var cached = require.cache[resolved];
+ var res = cached? cached.exports : mod();
+ return res;
+};
+
+require.paths = [];
+require.modules = {};
+require.cache = {};
+require.extensions = [".js",".coffee",".json"];
+
+require._core = {
+ 'assert': true,
+ 'events': true,
+ 'fs': true,
+ 'path': true,
+ 'vm': true
+};
+
+require.resolve = (function () {
+ return function (x, cwd) {
+ if (!cwd) cwd = '/';
+
+ if (require._core[x]) return x;
+ var path = require.modules.path();
+ cwd = path.resolve('/', cwd);
+ var y = cwd || '/';
+
+ if (x.match(/^(?:\.\.?\/|\/)/)) {
+ var m = loadAsFileSync(path.resolve(y, x))
+ || loadAsDirectorySync(path.resolve(y, x));
+ if (m) return m;
+ }
+
+ var n = loadNodeModulesSync(x, y);
+ if (n) return n;
+
+ throw new Error("Cannot find module '" + x + "'");
+
+ function loadAsFileSync (x) {
+ x = path.normalize(x);
+ if (require.modules[x]) {
+ return x;
+ }
+
+ for (var i = 0; i < require.extensions.length; i++) {
+ var ext = require.extensions[i];
+ if (require.modules[x + ext]) return x + ext;
+ }
+ }
+
+ function loadAsDirectorySync (x) {
+ x = x.replace(/\/+$/, '');
+ var pkgfile = path.normalize(x + '/package.json');
+ if (require.modules[pkgfile]) {
+ var pkg = require.modules[pkgfile]();
+ var b = pkg.browserify;
+ if (typeof b === 'object' && b.main) {
+ var m = loadAsFileSync(path.resolve(x, b.main));
+ if (m) return m;
+ }
+ else if (typeof b === 'string') {
+ var m = loadAsFileSync(path.resolve(x, b));
+ if (m) return m;
+ }
+ else if (pkg.main) {
+ var m = loadAsFileSync(path.resolve(x, pkg.main));
+ if (m) return m;
+ }
+ }
+
+ return loadAsFileSync(x + '/index');
+ }
+
+ function loadNodeModulesSync (x, start) {
+ var dirs = nodeModulesPathsSync(start);
+ for (var i = 0; i < dirs.length; i++) {
+ var dir = dirs[i];
+ var m = loadAsFileSync(dir + '/' + x);
+ if (m) return m;
+ var n = loadAsDirectorySync(dir + '/' + x);
+ if (n) return n;
+ }
+
+ var m = loadAsFileSync(x);
+ if (m) return m;
+ }
+
+ function nodeModulesPathsSync (start) {
+ var parts;
+ if (start === '/') parts = [ '' ];
+ else parts = path.normalize(start).split('/');
+
+ var dirs = [];
+ for (var i = parts.length - 1; i >= 0; i--) {
+ if (parts[i] === 'node_modules') continue;
+ var dir = parts.slice(0, i + 1).join('/') + '/node_modules';
+ dirs.push(dir);
+ }
+
+ return dirs;
+ }
+ };
+})();
+
+require.alias = function (from, to) {
+ var path = require.modules.path();
+ var res = null;
+ try {
+ res = require.resolve(from + '/package.json', '/');
+ }
+ catch (err) {
+ res = require.resolve(from, '/');
+ }
+ var basedir = path.dirname(res);
+
+ var keys = (Object.keys || function (obj) {
+ var res = [];
+ for (var key in obj) res.push(key);
+ return res;
+ })(require.modules);
+
+ for (var i = 0; i < keys.length; i++) {
+ var key = keys[i];
+ if (key.slice(0, basedir.length + 1) === basedir + '/') {
+ var f = key.slice(basedir.length);
+ require.modules[to + f] = require.modules[basedir + f];
+ }
+ else if (key === basedir) {
+ require.modules[to] = require.modules[basedir];
+ }
+ }
+};
+
+(function () {
+ var process = {};
+
+ require.define = function (filename, fn) {
+ if (require.modules.__browserify_process) {
+ process = require.modules.__browserify_process();
+ }
+
+ var dirname = require._core[filename]
+ ? ''
+ : require.modules.path().dirname(filename)
+ ;
+
+ var require_ = function (file) {
+ var requiredModule = require(file, dirname);
+ var cached = require.cache[require.resolve(file, dirname)];
+
+ if (cached && cached.parent === null) {
+ cached.parent = module_;
+ }
+
+ return requiredModule;
+ };
+ require_.resolve = function (name) {
+ return require.resolve(name, dirname);
+ };
+ require_.modules = require.modules;
+ require_.define = require.define;
+ require_.cache = require.cache;
+ var module_ = {
+ id : filename,
+ filename: filename,
+ exports : {},
+ loaded : false,
+ parent: null
+ };
+
+ require.modules[filename] = function () {
+ require.cache[filename] = module_;
+ fn.call(
+ module_.exports,
+ require_,
+ module_,
+ module_.exports,
+ dirname,
+ filename,
+ process
+ );
+ module_.loaded = true;
+ return module_.exports;
+ };
+ };
+})();
+
+
+require.define("path",function(require,module,exports,__dirname,__filename,process){function filter (xs, fn) {
+ var res = [];
+ for (var i = 0; i < xs.length; i++) {
+ if (fn(xs[i], i, xs)) res.push(xs[i]);
+ }
+ return res;
+}
+
+// resolves . and .. elements in a path array with directory names there
+// must be no slashes, empty elements, or device names (c:\) in the array
+// (so also no leading and trailing slashes - it does not distinguish
+// relative and absolute paths)
+function normalizeArray(parts, allowAboveRoot) {
+ // if the path tries to go above the root, `up` ends up > 0
+ var up = 0;
+ for (var i = parts.length; i >= 0; i--) {
+ var last = parts[i];
+ if (last == '.') {
+ parts.splice(i, 1);
+ } else if (last === '..') {
+ parts.splice(i, 1);
+ up++;
+ } else if (up) {
+ parts.splice(i, 1);
+ up--;
+ }
+ }
+
+ // if the path is allowed to go above the root, restore leading ..s
+ if (allowAboveRoot) {
+ for (; up--; up) {
+ parts.unshift('..');
+ }
+ }
+
+ return parts;
+}
+
+// Regex to split a filename into [*, dir, basename, ext]
+// posix version
+var splitPathRe = /^(.+\/(?!$)|\/)?((?:.+?)?(\.[^.]*)?)$/;
+
+// path.resolve([from ...], to)
+// posix version
+exports.resolve = function() {
+var resolvedPath = '',
+ resolvedAbsolute = false;
+
+for (var i = arguments.length; i >= -1 && !resolvedAbsolute; i--) {
+ var path = (i >= 0)
+ ? arguments[i]
+ : process.cwd();
+
+ // Skip empty and invalid entries
+ if (typeof path !== 'string' || !path) {
+ continue;
+ }
+
+ resolvedPath = path + '/' + resolvedPath;
+ resolvedAbsolute = path.charAt(0) === '/';
+}
+
+// At this point the path should be resolved to a full absolute path, but
+// handle relative paths to be safe (might happen when process.cwd() fails)
+
+// Normalize the path
+resolvedPath = normalizeArray(filter(resolvedPath.split('/'), function(p) {
+ return !!p;
+ }), !resolvedAbsolute).join('/');
+
+ return ((resolvedAbsolute ? '/' : '') + resolvedPath) || '.';
+};
+
+// path.normalize(path)
+// posix version
+exports.normalize = function(path) {
+var isAbsolute = path.charAt(0) === '/',
+ trailingSlash = path.slice(-1) === '/';
+
+// Normalize the path
+path = normalizeArray(filter(path.split('/'), function(p) {
+ return !!p;
+ }), !isAbsolute).join('/');
+
+ if (!path && !isAbsolute) {
+ path = '.';
+ }
+ if (path && trailingSlash) {
+ path += '/';
+ }
+
+ return (isAbsolute ? '/' : '') + path;
+};
+
+
+// posix version
+exports.join = function() {
+ var paths = Array.prototype.slice.call(arguments, 0);
+ return exports.normalize(filter(paths, function(p, index) {
+ return p && typeof p === 'string';
+ }).join('/'));
+};
+
+
+exports.dirname = function(path) {
+ var dir = splitPathRe.exec(path)[1] || '';
+ var isWindows = false;
+ if (!dir) {
+ // No dirname
+ return '.';
+ } else if (dir.length === 1 ||
+ (isWindows && dir.length <= 3 && dir.charAt(1) === ':')) {
+ // It is just a slash or a drive letter with a slash
+ return dir;
+ } else {
+ // It is a full dirname, strip trailing slash
+ return dir.substring(0, dir.length - 1);
+ }
+};
+
+
+exports.basename = function(path, ext) {
+ var f = splitPathRe.exec(path)[2] || '';
+ // TODO: make this comparison case-insensitive on windows?
+ if (ext && f.substr(-1 * ext.length) === ext) {
+ f = f.substr(0, f.length - ext.length);
+ }
+ return f;
+};
+
+
+exports.extname = function(path) {
+ return splitPathRe.exec(path)[3] || '';
+};
+
+});
+
+require.define("__browserify_process",function(require,module,exports,__dirname,__filename,process){var process = module.exports = {};
+
+process.nextTick = (function () {
+ var canSetImmediate = typeof window !== 'undefined'
+ && window.setImmediate;
+ var canPost = typeof window !== 'undefined'
+ && window.postMessage && window.addEventListener
+ ;
+
+ if (canSetImmediate) {
+ return window.setImmediate;
+ }
+
+ if (canPost) {
+ var queue = [];
+ window.addEventListener('message', function (ev) {
+ if (ev.source === window && ev.data === 'browserify-tick') {
+ ev.stopPropagation();
+ if (queue.length > 0) {
+ var fn = queue.shift();
+ fn();
+ }
+ }
+ }, true);
+
+ return function nextTick(fn) {
+ queue.push(fn);
+ window.postMessage('browserify-tick', '*');
+ };
+ }
+
+ return function nextTick(fn) {
+ setTimeout(fn, 0);
+ };
+})();
+
+process.title = 'browser';
+process.browser = true;
+process.env = {};
+process.argv = [];
+
+process.binding = function (name) {
+ if (name === 'evals') return (require)('vm')
+ else throw new Error('No such module. (Possibly not yet loaded)')
+};
+
+(function () {
+ var cwd = '/';
+ var path;
+ process.cwd = function () { return cwd };
+ process.chdir = function (dir) {
+ if (!path) path = require('path');
+ cwd = path.resolve(dir, cwd);
+ };
+})();
+
+});
+
+require.define("/foo.js",function(require,module,exports,__dirname,__filename,process){// foo.js
+
+module.exports = function (n) {
+ return n * 111;
+};
+
+});
+
+require.define("/main.js",function(require,module,exports,__dirname,__filename,process){// main.js
+
+var foo = require('./foo');
+
+document.querySelector('pre').textContent = foo(5);
+
+});
+require("/main.js");
+})();
7 bundle/static/index.html
@@ -0,0 +1,7 @@
+<html>
+<body>
+<style> pre { font-size: 72px; } </style>
+<pre></pre>
+</body>
+<script src="/bundle.js"></script>
+</html>
5 dnode_shoe/000_title.js
@@ -0,0 +1,5 @@
+/*
+
+ using dnode in shoe
+
+*/
5 dnode_shoe/010_server.js
@@ -0,0 +1,5 @@
+var http = require('http');
+var ecstatic = require('ecstatic')(__dirname + '/static');
+
+var server = http.createServer(ecstatic);
+server.listen(8005);
10 dnode_shoe/020_server.js
@@ -0,0 +1,10 @@
+var http = require('http');
+var ecstatic = require('ecstatic')(__dirname + '/static');
+
+var server = http.createServer(ecstatic);
+server.listen(8005);
+
+var shoe = require('shoe');
+var sock = shoe(function (stream) {
+ // ...
+});
11 dnode_shoe/030_server.js
@@ -0,0 +1,11 @@
+var http = require('http');
+var ecstatic = require('ecstatic')(__dirname + '/static');
+
+var server = http.createServer(ecstatic);
+server.listen(8005);
+
+var shoe = require('shoe');
+var sock = shoe(function (stream) {
+ // ...
+});
+sock.install(server, '/dnode');
16 dnode_shoe/040_server.js
@@ -0,0 +1,16 @@
+var http = require('http');
+var ecstatic = require('ecstatic')(__dirname + '/static');
+
+var server = http.createServer(ecstatic);
+server.listen(8005);
+
+var shoe = require('shoe');
+var dnode = require('dnode');
+
+var sock = shoe(function (stream) {
+ var d = dnode({
+ // ...
+ });
+ d.pipe(stream).pipe(d);
+});
+sock.install(server, '/dnode');
19 dnode_shoe/050_server.js
@@ -0,0 +1,19 @@
+var http = require('http');
+var ecstatic = require('ecstatic')(__dirname + '/static');
+
+var server = http.createServer(ecstatic);
+server.listen(8005);
+
+var shoe = require('shoe');
+var dnode = require('dnode');
+
+var sock = shoe(function (stream) {
+ var d = dnode({
+ transform : function (s, cb) {
+ var res = s.replace(/[aeiou]{2,}/, 'oo').toUpperCase();
+ cb(res);
+ }
+ });
+ d.pipe(stream).pipe(d);
+});
+sock.install(server, '/dnode');
2  dnode_shoe/110_client.js
@@ -0,0 +1,2 @@
+var shoe = require('shoe');
+var stream = shoe('/dnode');
6 dnode_shoe/120_client.js
@@ -0,0 +1,6 @@
+var shoe = require('shoe');
+var dnode = require('dnode');
+var stream = shoe('/dnode');
+
+var d = dnode();
+d.pipe(stream).pipe(d);
9 dnode_shoe/130_client.js
@@ -0,0 +1,9 @@
+var shoe = require('shoe');
+var dnode = require('dnode');
+var stream = shoe('/dnode');
+
+var d = dnode();
+d.on('remote', function (remote) {
+ // ..
+});
+d.pipe(stream).pipe(d);
11 dnode_shoe/140_client.js
@@ -0,0 +1,11 @@
+var shoe = require('shoe');
+var dnode = require('dnode');
+var stream = shoe('/dnode');
+
+var d = dnode();
+d.on('remote', function (remote) {
+ remote.transform('beep', function (s) {
+ // ...
+ });
+});
+d.pipe(stream).pipe(d);
13 dnode_shoe/150_client.js
@@ -0,0 +1,13 @@
+var shoe = require('shoe');
+var dnode = require('dnode');
+var stream = shoe('/dnode');
+
+var d = dnode();
+d.on('remote', function (remote) {
+ remote.transform('beep', function (s) {
+ document.body.textContent = 'beep => ' + s;
+ });
+});
+d.pipe(stream).pipe(d);
+
+// ./run1.sh
7 dnode_shoe/run1.sh
@@ -0,0 +1,7 @@
+#!/bin/bash
+
+echo '#' browserify 050_client.js -o static/bundle.js
+browserify 150_client.js -o static/bundle.js
+
+echo http://localhost:8005
+node 050_server.js
4,579 dnode_shoe/static/bundle.js
4,579 additions, 0 deletions not shown
5 dnode_shoe/static/index.html
@@ -0,0 +1,5 @@
+<html>
+<body>
+<script src="bundle.js"></script>
+</body>
+</html>
7 emit-stream/000_title.js
@@ -0,0 +1,7 @@
+/*
+ emit-stream
+
+ - turn EventEmitters into streams
+ - and streams into EventEmitters
+
+*/
2  emit-stream/005.js
@@ -0,0 +1,2 @@
+var EventEmitter = require('events').EventEmitter;
+var em = new EventEmitter;
5 emit-stream/010.js
@@ -0,0 +1,5 @@
+var EventEmitter = require('events').EventEmitter;
+var em = new EventEmitter;
+
+var emitStream = require('emit-stream');
+var stream = emitStream(em);
9 emit-stream/020.js
@@ -0,0 +1,9 @@
+var EventEmitter = require('events').EventEmitter;
+var em = new EventEmitter;
+
+var emitStream = require('emit-stream');
+var stream = emitStream(em);
+
+stream.on('data', function (x) {
+ console.dir(x);
+});
11 emit-stream/030.js
@@ -0,0 +1,11 @@
+var EventEmitter = require('events').EventEmitter;
+var em = new EventEmitter;
+
+var emitStream = require('emit-stream');
+var stream = emitStream(em);
+
+stream.on('data', function (x) {
+ console.dir(x);
+});
+
+em.emit('beep', 'boop');
12 emit-stream/040.js
@@ -0,0 +1,12 @@
+var EventEmitter = require('events').EventEmitter;
+var em = new EventEmitter;
+
+var JSONStream = require('JSONStream');
+var emitStream = require('emit-stream');
+var stream = emitStream(em).pipe(JSONStream.stringify());
+
+stream.on('data', function (x) {
+ console.dir(x);
+});
+
+em.emit('beep', 'boop');
14 emit-stream/050.js
@@ -0,0 +1,14 @@
+var EventEmitter = require('events').EventEmitter;
+var em = new EventEmitter;
+
+var JSONStream = require('JSONStream');
+var emitStream = require('emit-stream');
+var stream = emitStream(em).pipe(JSONStream.stringify());
+
+stream.on('data', function (x) {
+ console.dir(x);
+});
+
+setInterval(function () {
+ em.emit('beep', 'boop');
+}, 100);
14 emit-stream/060.js
@@ -0,0 +1,14 @@
+var EventEmitter = require('events').EventEmitter;
+var em = new EventEmitter;
+
+var JSONStream = require('JSONStream');
+var emitStream = require('emit-stream');
+var stream = emitStream(em).pipe(JSONStream.stringify());
+
+stream.pipe(process.stdout);
+
+setInterval(function () {
+ em.emit('beep', 'boop');
+}, 100);
+
+// ./run1.sh
23 emit-stream/070.js
@@ -0,0 +1,23 @@
+var EventEmitter = require('events').EventEmitter;
+var em = new EventEmitter;
+
+var JSONStream = require('JSONStream');
+var emitStream = require('emit-stream');
+
+var ecstatic = require('ecstatic')(__dirname + '/static');
+var http = require('http');
+
+var server = http.createServer(function (req, res) {
+ if (req.url === '/stream') {
+ var es = emitStream(em).pipe(JSONStream.stringify());
+ es.pipe(res);
+ }
+ else ecstatic(req, res)
+});
+server.listen(8005);
+
+setInterval(function () {
+ em.emit('beep', 'boop');
+}, 100);
+
+// ./run2.sh
5 emit-stream/080_client.js
@@ -0,0 +1,5 @@
+var request = require('request');
+var stream = request('http://localhost:8005/stream');
+stream.pipe(process.stdout);
+
+// ./run3.sh
4 emit-stream/090_client.js
@@ -0,0 +1,4 @@
+var request = require('request');
+var emitStream = require('emit-stream');
+
+var stream = request('http://localhost:8005/stream');
5 emit-stream/100_client.js
@@ -0,0 +1,5 @@
+var request = require('request');
+var emitStream = require('emit-stream');
+
+var stream = request('http://localhost:8005/stream');
+var e = emitStream(stream...)
6 emit-stream/110_client.js
@@ -0,0 +1,6 @@
+var request = require('request');
+var emitStream = require('emit-stream');
+var JSONStream = require('JSONStream');
+
+var stream = request('http://localhost:8005/stream');
+var e = emitStream(stream.pipe(JSONStream.parse([true])));
12 emit-stream/120_client.js
@@ -0,0 +1,12 @@
+var request = require('request');
+var emitStream = require('emit-stream');
+var JSONStream = require('JSONStream');
+
+var stream = request('http://localhost:8005/stream');
+var e = emitStream(stream.pipe(JSONStream.parse([true])));
+
+e.on('beep', function (x) {
+ console.log('beep :: ' + x);
+});
+
+// ./run4.sh
14 emit-stream/130_browser.js
@@ -0,0 +1,14 @@
+var request = require('request');
+var emitStream = require('emit-stream');
+var JSONStream = require('JSONStream');
+
+var stream = request('http://localhost:8005/stream');
+var e = emitStream(stream.pipe(JSONStream.parse([true])));
+
+e.on('beep', function (x) {
+ var div = document.createElement('div');
+ div.textContent = 'beep :: ' + x;
+ document.body.appendChild(div);
+});
+
+// ./run5.sh
3  emit-stream/run1.sh
@@ -0,0 +1,3 @@
+#!/bin/bash
+
+node 060.js
4 emit-stream/run2.sh
@@ -0,0 +1,4 @@
+#!/bin/bash
+
+echo '#' curl -sS http://localhost:8005/stream
+node 070.js
7 emit-stream/run3.sh
@@ -0,0 +1,7 @@
+#!/bin/bash
+
+node 070.js &
+
+sleep 1
+
+node 080_client.js
7 emit-stream/run4.sh
@@ -0,0 +1,7 @@
+#!/bin/bash
+
+node 070.js &
+
+sleep 1
+
+node 120_client.js
7 emit-stream/run5.sh
@@ -0,0 +1,7 @@
+#!/bin/bash
+
+echo '#' browserify 130_browser.js -o static/bundle.js
+browserify 130_browser.js -o static/bundle.js
+
+echo http://localhost:8005
+node 070.js
4,368 emit-stream/static/bundle.js
4,368 additions, 0 deletions not shown
5 emit-stream/static/index.html
@@ -0,0 +1,5 @@
+<html>
+<body>
+<script src="bundle.js"></script>
+</body>
+</html>
9 order.txt
@@ -0,0 +1,9 @@
+bundle
+ast
+JSONStream
+emit-stream
+shoe
+dnode_shoe
+roll_your_own_socketio
+scuttlebutt
+tap_output
7 roll_your_own_socketio/000_title.js
@@ -0,0 +1,7 @@
+/*
+
+ roll your own socket.io
+
+ using shoe and emit-stream
+
+*/
4 roll_your_own_socketio/001_server.js
@@ -0,0 +1,4 @@
+var http = require('http');
+
+var server = http.createServer(require('ecstatic')(__dirname + '/static'));
+server.listen(8005);
1  roll_your_own_socketio/005_server.js
@@ -0,0 +1 @@
+var http = require('http');
6 roll_your_own_socketio/010_server.js
@@ -0,0 +1,6 @@
+var http = require('http');
+
+var server = http.createServer(require('ecstatic')(__dirname + '/static'));
+server.listen(8005);
+
+var shoe = require('shoe');
12 roll_your_own_socketio/020_server.js
@@ -0,0 +1,12 @@
+var http = require('http');
+
+var server = http.createServer(require('ecstatic')(__dirname + '/static'));
+server.listen(8005);
+
+var shoe = require('shoe');
+
+var sock = shoe(function (stream) {
+ // ...
+});
+
+sock.install(server, '/sock');
15 roll_your_own_socketio/030_server.js
@@ -0,0 +1,15 @@
+var http = require('http');
+
+var server = http.createServer(require('ecstatic')(__dirname + '/static'));
+server.listen(8005);
+
+var shoe = require('shoe');
+
+var sock = shoe(function (stream) {
+ var i = 0;
+ setInterval(function () {
+ stream.write(String(i++ % 2));
+ }, 100);
+});
+
+sock.install(server, '/sock');
1  roll_your_own_socketio/040_browser.js
@@ -0,0 +1 @@
+var shoe = require('shoe');
2  roll_your_own_socketio/050_browser.js
@@ -0,0 +1,2 @@
+var shoe = require('shoe');
+var stream = shoe('/sock');
8 roll_your_own_socketio/060_browser.js
@@ -0,0 +1,8 @@
+var shoe = require('shoe');
+var stream = shoe('/sock');
+
+stream.on('data', function (buf) {
+ document.body.textContent += buf;
+});
+
+// ./run1.sh
16 roll_your_own_socketio/070_server.js
@@ -0,0 +1,16 @@
+var http = require('http');
+var EventEmitter = require('events').EventEmitter;
+
+var server = http.createServer(require('ecstatic')(__dirname + '/static'));
+server.listen(8005);
+
+var shoe = require('shoe');
+
+var sock = shoe(function (stream) {
+ var i = 0;
+ setInterval(function () {
+ stream.write(String(i++ % 2));
+ }, 100);
+});
+
+sock.install(server, '/sock');
18 roll_your_own_socketio/080_server.js
@@ -0,0 +1,18 @@
+var http = require('http');
+var EventEmitter = require('events').EventEmitter;
+
+var server = http.createServer(require('ecstatic')(__dirname + '/static'));
+server.listen(8005);
+
+var shoe = require('shoe');
+
+var sock = shoe(function (stream) {
+ var ev = new EventEmitter;
+
+ var i = 0;
+ setInterval(function () {
+ stream.write(String(i++ % 2));
+ }, 100);
+});
+
+sock.install(server, '/sock');
18 roll_your_own_socketio/090_server.js
@@ -0,0 +1,18 @@
+var http = require('http');
+var EventEmitter = require('events').EventEmitter;
+
+var server = http.createServer(require('ecstatic')(__dirname + '/static'));
+server.listen(8005);
+
+var shoe = require('shoe');
+
+var sock = shoe(function (stream) {
+ var ev = new EventEmitter;
+
+ var i = 0;
+ setInterval(function () {
+ ev.emit('upper', i++ % 2);
+ }, 100);
+});
+
+sock.install(server, '/sock');
20 roll_your_own_socketio/100_server.js
@@ -0,0 +1,20 @@
+var http = require('http');
+var EventEmitter = require('events').EventEmitter;
+
+var server = http.createServer(require('ecstatic')(__dirname + '/static'));
+server.listen(8005);
+
+var shoe = require('shoe');
+var emitStream = require('emit-stream');
+var JSONStream = require('JSONStream');
+
+var sock = shoe(function (stream) {
+ var ev = new EventEmitter;
+
+ var i = 0;
+ setInterval(function () {
+ ev.emit('upper', i++ % 2);
+ }, 100);
+});
+
+sock.install(server, '/sock');
22 roll_your_own_socketio/110_server.js
@@ -0,0 +1,22 @@
+var http = require('http');
+var EventEmitter = require('events').EventEmitter;
+
+var server = http.createServer(require('ecstatic')(__dirname + '/static'));
+server.listen(8005);
+
+var shoe = require('shoe');
+var emitStream = require('emit-stream');
+var JSONStream = require('JSONStream');
+
+var sock = shoe(function (stream) {
+ var ev = new EventEmitter;
+ emitStream(ev)
+ .pipe(JSONStream.stringify())
+
+ var i = 0;
+ setInterval(function () {
+ ev.emit('upper', i++ % 2);
+ }, 100);
+});
+
+sock.install(server, '/sock');
24 roll_your_own_socketio/120_server.js
@@ -0,0 +1,24 @@
+var http = require('http');
+var EventEmitter = require('events').EventEmitter;
+
+var server = http.createServer(require('ecstatic')(__dirname + '/static'));
+server.listen(8005);
+
+var shoe = require('shoe');
+var emitStream = require('emit-stream');
+var JSONStream = require('JSONStream');
+
+var sock = shoe(function (stream) {
+ var ev = new EventEmitter;
+ emitStream(ev)
+ .pipe(JSONStream.stringify())
+ .pipe(stream)
+ ;
+
+ var i = 0;
+ setInterval(function () {
+ ev.emit('upper', i++ % 2);
+ }, 100);
+});
+
+sock.install(server, '/sock');
33 roll_your_own_socketio/130_server.js
@@ -0,0 +1,33 @@
+var http = require('http');
+var EventEmitter = require('events').EventEmitter;
+
+var server = http.createServer(require('ecstatic')(__dirname + '/static'));
+server.listen(8005);
+
+var shoe = require('shoe');
+var emitStream = require('emit-stream');
+var JSONStream = require('JSONStream');
+
+var sock = shoe(function (stream) {
+ var ev = new EventEmitter;
+ emitStream(ev)
+ .pipe(JSONStream.stringify())
+ .pipe(stream)
+ ;
+
+ var intervals = [];
+
+ intervals.push(setInterval(function () {
+ ev.emit('upper', 'abc');
+ }, 500));
+
+ intervals.push(setInterval(function () {
+ ev.emit('lower', 'def');
+ }, 300));
+
+ stream.on('end', function () {
+ intervals.forEach(clearInterval);
+ });
+});
+
+sock.install(server, '/sock');
7 roll_your_own_socketio/140_browser.js
@@ -0,0 +1,7 @@
+var shoe = require('shoe');
+
+var stream = shoe('/sock');
+
+stream.on('data', function (buf) {
+ document.body.textContent += buf;
+});
9 roll_your_own_socketio/150_browser.js
@@ -0,0 +1,9 @@
+var shoe = require('shoe');
+var emitStream = require('emit-stream');
+var JSONStream = require('JSONStream');
+
+var stream = shoe('/sock');
+
+stream.on('data', function (buf) {
+ document.body.textContent += buf;
+});
10 roll_your_own_socketio/160_browser.js
@@ -0,0 +1,10 @@
+var shoe = require('shoe');
+var emitStream = require('emit-stream');
+var JSONStream = require('JSONStream');
+
+var parser = JSONStream.parse([true]);
+var stream = shoe('/sock');
+
+stream.on('data', function (buf) {
+ document.body.textContent += buf;
+});
10 roll_your_own_socketio/170_browser.js
@@ -0,0 +1,10 @@
+var shoe = require('shoe');
+var emitStream = require('emit-stream');
+var JSONStream = require('JSONStream');
+
+var parser = JSONStream.parse([true]);
+var stream = parser.pipe(shoe('/sock')).pipe(parser);
+
+stream.on('data', function (buf) {
+ document.body.textContent += buf;
+});
15 roll_your_own_socketio/180_browser.js
@@ -0,0 +1,15 @@
+var shoe = require('shoe');
+var emitStream = require('emit-stream');
+var JSONStream = require('JSONStream');
+
+var parser = JSONStream.parse([true]);
+var stream = parser.pipe(shoe('/sock')).pipe(parser);
+var ev = emitStream(stream);
+
+ev.on('lower', function (msg) {
+ // ...
+});
+
+ev.on('upper', function (msg) {
+ // ...
+});
21 roll_your_own_socketio/190_browser.js
@@ -0,0 +1,21 @@
+var shoe = require('shoe');
+var emitStream = require('emit-stream');
+var JSONStream = require('JSONStream');
+
+var parser = JSONStream.parse([true]);
+var stream = parser.pipe(shoe('/sock')).pipe(parser);
+var ev = emitStream(stream);
+
+ev.on('lower', function (msg) {
+ var div = document.createElement('div');
+ div.textContent = msg.toLowerCase();
+ document.body.appendChild(div);
+});
+
+ev.on('upper', function (msg) {
+ var div = document.createElement('div');
+ div.textContent = msg.toUpperCase();
+ document.body.appendChild(div);
+});
+
+// ./run2.sh
2  roll_your_own_socketio/node_modules/JSONStream/.npmignore
@@ -0,0 +1,2 @@
+node_modules/*
+node_modules
4 roll_your_own_socketio/node_modules/JSONStream/.travis.yml
@@ -0,0 +1,4 @@
+language: node_js
+node_js:
+ - 0.4
+ - 0.6
15 roll_your_own_socketio/node_modules/JSONStream/LICENSE.APACHE2
@@ -0,0 +1,15 @@
+Apache License, Version 2.0
+
+Copyright (c) 2011 Dominic Tarr
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
24 roll_your_own_socketio/node_modules/JSONStream/LICENSE.MIT
@@ -0,0 +1,24 @@
+The MIT License
+
+Copyright (c) 2011 Dominic Tarr
+
+Permission is hereby granted, free of charge,
+to any person obtaining a copy of this software and
+associated documentation files (the "Software"), to
+deal in the Software without restriction, including
+without limitation the rights to use, copy, modify,
+merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom
+the Software is furnished to do so,
+subject to the following conditions:
+
+The above copyright notice and this permission notice
+shall be included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
+ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
13 roll_your_own_socketio/node_modules/JSONStream/examples/all_docs.js
@@ -0,0 +1,13 @@
+var request = require('request')
+ , JSONStream = require('JSONStream')
+ , es = require('event-stream')
+
+var parser = JSONStream.parse(['rows', true]) //emit parts that match this path (any element of the rows array)
+ , req = request({url: 'http://isaacs.couchone.com/registry/_all_docs'})
+ , logger = es.mapSync(function (data) { //create a stream that logs to stderr,
+ console.error(data)
+ return data
+ })
+
+req.pipe(parser)
+parser.pipe(logger)
171 roll_your_own_socketio/node_modules/JSONStream/index.js
@@ -0,0 +1,171 @@
+var Parser = require('jsonparse')
+ , Stream = require('stream').Stream
+
+/*
+
+ the value of this.stack that creationix's jsonparse has is weird.
+
+ it makes this code ugly, but his problem is way harder that mine,
+ so i'll forgive him.
+
+*/
+
+exports.parse = function (path) {
+
+ var stream = new Stream()
+ var parser = new Parser()
+ var count = 0
+ if(!path.length)
+ path = null
+ parser.onValue = function () {
+ if(!this.root && this.stack.length == 1){
+ stream.root = this.value
+ }
+ if(!path || this.stack.length !== path.length)
+ return
+ var _path = []
+ for( var i = 0; i < (path.length - 1); i++) {
+ var key = path[i]
+ var c = this.stack[1 + (+i)]
+
+ if(!c) {
+ return
+ }
+ var m = check(key, c.key)
+ _path.push(c.key)
+
+ if(!m)
+ return
+
+ }
+ var c = this
+
+ var key = path[path.length - 1]
+ var m = check(key, c.key)
+ if(!m)
+ return
+ _path.push(c.key)
+
+ count ++
+ stream.emit('data', this.value[this.key])
+ }
+
+
+ parser.onError = function (err) {
+ stream.emit('error', err)
+ }
+ stream.readable = true
+ stream.writable = true
+ stream.write = function (chunk) {
+ if('string' === typeof chunk) {
+ if ('undefined' === typeof Buffer) {