Skip to content

Instantly share code, notes, and snippets.

View isc-rsingh's full-sized avatar

Raj Singh isc-rsingh

View GitHub Profile
@isc-rsingh
isc-rsingh / deleteSkipDDocs.js
Last active August 29, 2015 14:08
NodeJS app to delete all documents in the given Cloudant database except for design documents
/**
* deletes all records in the given database except for design documents
*/
var Cloudant = require('cloudant')
if ( process.argv.length < 4) {
console.warn("usage: node deleteall.js <account_name> <database_name>");
process.exit(1);
}
@isc-rsingh
isc-rsingh / shapefile2couchdb.js
Last active March 24, 2016 19:18
Converts an on-disk Shapefile into GeoJSON and imports the data into a CouchDB-compatible database (e.g. Cloudant) using node.js.
/**
* Converts an on-disk Shapefile into GeoJSON and imports the data into a CouchDB-compatible database,
* like Cloudant.com!
* requires Node.js and the 'cradle' and 'shapefile' modules.
* - installation: save this code to a file called index.js
* - at the shell: npm install cradle
* - at the shell: npm install shapefile
* - at the shell, run the program: node index.js
*/
var cradle = require('cradle'); // npm install cradle
@isc-rsingh
isc-rsingh / shapefile2cloudant.js
Last active August 29, 2015 14:07
Converts an on-disk Shapefile into GeoJSON and imports the data into your Cloudant database using node.js.
/**
* Converts an on-disk Shapefile into GeoJSON and imports the data into your Cloudant database
* requires Node.js and the 'cloudant' and 'shapefile' modules.
* - installation: save this code to a file called index.js
* - at the shell: npm install cloudant
* - at the shell: npm install shapefile
* - at the shell, run the program: node index.js
*/
var Cloudant = require('cloudant'); // npm install cloudant
var shapefile = require('shapefile'); // npm install shapefile