Skip to content

Instantly share code, notes, and snippets.

View rbpasker's full-sized avatar

bob pasker rbpasker

View GitHub Profile
function(doc){
if (doc.summary)
index("subject", doc.summary, {"store" : "yes"});
if (doc.description)
index("subject", doc.description, {"store" : "yes"});
}
// A `collection` representing a view result. View query parameters should be
// passed in via `cloudant_options`.
Backbone.Cloudant.View = {
Collection: Backbone.Cloudant.Collection.extend({
// Name of the design document containing the view.
design: "my_design",
// Name of the view.
view: "my_view",
// Generate the correct base URL (without query parameters) for the view.
foo = None
def bar(newfoo):
foo=newfoo
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Bootstrap -->
<link href="bootstrap/css/bootstrap.min.css" rel="stylesheet" media="screen">
</head>
<body>
{
"total_rows": 2,
"bookmark": "g1AAAACDeJzLYWBgYMpgTmGQS0lKzi9KdUhJMjTVyyrNSS3QS87JL01JzCvRy0styQGpS2RIsv___39WBpOb_efU3wlAsUR0zSa4NCc5AMmkepj-13G-D0D6GbIAvXEq-A",
"rows": [
{
"id": "[email protected]",
"order": [
1.2123979330062866,
2
],
Backbone.Cloudant.database = "/sandbox/";
// start the change handler
// Backbone.Cloudant.changeHandler();
PeopleView = Backbone.View.extend({
initialize: function () {
this.listenTo(this.collection, 'reset', this.render);
},
template: _.template($("#person_template").html()),
Backbone.Cloudant.database = "/sandbox/";
// start the change handler
// Backbone.Cloudant.changeHandler();
PersonView = Backbone.View.extend({
initialize: function () {
this.render();
},
template: _.template($("#person_template").html()),
// tuples shown instead of objects, for brevity
map output:
[id1, "a", null]
[id1, "a", null]
[id2, "a", null]
[id2, "b", null]
[id3, "b", null]
[id4, "c", null]
$ curl -X GET -u XXXXX 'https://tengahdb.cloudant.com/sandbox/_design/extractmail.js'
{"_id":"_design\/extractmail.js","_rev":"7-708c30ba24efeabb5eb451c9412d4c96","views":{"all":"function(doc) { emit(doc._id, doc); } "}}
$ curl -X GET -u XXXXX 'https://tengahdb.cloudant.com/sandbox/_design/extractmail.js/_view/all'
{"error":"not_found","reason":"missing_named_view"}
Python 2.7.2 (default, Jun 16 2012, 12:38:40)
[GCC 4.2.1 Compatible Apple Clang 4.0 (tags/Apple/clang-418.0.60)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import json, requests
>>>
>>> url = 'http://maps.googleapis.com/maps/api/directions/json'
>>>
>>> params = dict(
... origin='Chicago,IL',
... destination='Los+Angeles,CA',