Skip to content

Instantly share code, notes, and snippets.

@rakyll
Created June 3, 2013 12:26
Show Gist options
  • Save rakyll/5697776 to your computer and use it in GitHub Desktop.
Save rakyll/5697776 to your computer and use it in GitHub Desktop.
{
"_id": "_design/rate",
"_rev": "57-8b50b18751ef1f968628606142c84e27",
"language": "javascript",
"views": {
"five_minutes": {
"map": "function(doc) {\n var date = new Date(doc.createdAt).toISOString();\n var key = date.substr(0, 15);\n \n key += (parseInt(date.substr(15,1), 10) < 5) ? '0' : '5';\n emit([key + \":00Z\", doc.tag], 1);\n}",
"reduce": "function(keys, values) {\n return sum(values);\n}"
}
},
"shows": {
"ten_minutes": "function(doc, req) {\n return {\n body: toJSON(doc),\n headers: {'Access-Control-Allow-Origin': '*'}\n };\n}"
},
"lists": {
"index": "function(head, req) { var html = ''; while (row = getRow()) { html += '<li>' + row.key + ':' + row.value + '\n'; } return html; }"
},
"_attachments": {
"graph.html": {
"content_type": "text/html",
"revpos": 56,
"digest": "md5-MzmwTZoRRV3XBM/AOTQe3w==",
"length": 2142,
"stub": true
},
"d3.v3.js": {
"content_type": "application/x-javascript",
"revpos": 23,
"digest": "md5-KSSDHTLPkgfGm6ZUqh4tuA==",
"length": 298053,
"stub": true
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment