Skip to content

Instantly share code, notes, and snippets.

View jeffcogswell's full-sized avatar

Jeffrey Cogswell jeffcogswell

View GitHub Profile
@jeffcogswell
jeffcogswell / create_C_index.js
Last active August 29, 2015 14:03
Cloudant Index Creation using node and nano.js
/*
nano doesn't yet have support for Cloudant's new index feature,
but you can still do it using nano's request function.
This code creates an index.
To try this, first replicate the database as per
instructions here:
http://docs.cloudant.com/guides/cloudant-query.html
@jeffcogswell
jeffcogswell / q_example.js
Last active August 12, 2022 01:22
Here's another chaining example on using q.js. This doesn't have any error handling, as I just want to demonstrate the chaining concept. Please read the comments carefully, as I start out with a non-q example, to show the order of flow. Please post comments if there's anything that isn't clear and I'll try to revise it as needed.
// Q sample by Jeff Cogswell
/*===========
We want to call these three functions in sequence, one after the other:
First we want to call one, which initiates an ajax call. Once that
ajax call is complete, we want to call two. Once two's ajax call is
complete, we want to call three.
BUT, we don't want to just call our three functions in sequence, as this quick