   return 0
 
 
+localToGlobal = (loc, glo) ->
+  Object.keys(loc).forEach (key) ->
+    glo[key] = 0 unless glo[key]
+    glo[key] += loc[key] or 0
+
 i = 0
+# WARNING this function should not be exported
+# it's intended to collect metadata about all the blocks we know of
+# see elasticsearch.coffee for a version of the function that has no side-effects
 gistParser = (gist, gistCb) ->
   #console.log "NOT RETURNING", gist.id, singleId
   i++

  fs.writeFileSync "data/parsed/files-blocks.json", JSON.stringify(fileBlocks)

  libcsv = "url,count\n"
  Object.keys(libHash).forEach (lib) ->
    libcsv += lib + "," + libHash[lib] + "\n"
  fs.writeFileSync("data/parsed/libs.csv", libcsv)

  modulescsv = "module,count\n"
  Object.keys(moduleHash).forEach (module) ->
    modulescsv += module + "," + moduleHash[module] + "\n"
  fs.writeFileSync("data/parsed/modules.csv", modulescsv)

  console.log "err", err if err

  , () ->
    if Object.keys(gapiHash).length > 0
      gist.api = gapiHash
      localToGlobal(gapiHash, apiHash)
      apiBlocks.push pruneApi(gist)
    if Object.keys(gmoduleHash).length > 0
      gist.d3modules = gmoduleHash
      localToGlobal(gmoduleHash, moduleHash)
    if Object.keys(gcolorHash).length > 0
      gist.colors = gcolorHash
      localToGlobal(gcolorHash, colorHash)
      colorBlocks.push pruneColors(gist)
      colorBlocksMin.push pruneColorsMin(gist)
    # if Object.keys(glibHash).length > 0
