= Scratchpad = Scratchpad is a simple “nopaste” service that is [source:trunk/examples/scratchpad included] with Diva as an example application. It uses [http://incubator.apache.org/couchdb/ CouchDB] (via the [http://code.google.com/p/couchdb-python/ CouchDB-Python] library) for storage, and [http://pygments.org/ Pygments] for syntax highlighting. == CouchDB Views == [[PageOutline(3-4, Views)]] All views are in Javascript. === `_design/snippets` === ==== `by_author` ==== {{{ #!text/javascript function(doc) { if (doc.author) { emit([doc.author, doc.time], { title: doc.title, author: doc.author, time: doc.time, mimetype: doc.mimetype, description: doc.description, num_comments: doc.comments ? doc.comments.length : 0 }); } } }}} ==== `by_time` ==== {{{ #!text/javascript function(doc) { emit([doc.time, doc.title], { title: doc.title, author: doc.author, time: doc.time, mimetype: doc.mimetype, description: doc.description, num_comments: doc.comments ? doc.comments.length : 0 }); } }}} ==== `by_type` ==== {{{ #!text/javascript function(doc) { emit([doc.mimetype, doc.time], { title: doc.title, author: doc.author, time: doc.time, mimetype: doc.mimetype, description: doc.description, num_comments: doc.comments ? doc.comments.length : 0 }) } }}}