Skip to content

Instantly share code, notes, and snippets.

@ronyrun
ronyrun / launch.json
Created May 14, 2020 — forked from favasconcelos/launch.json
NestJS - VSCode - DEBUG
View launch.json
{
"version": "0.1.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Debug Nest JS",
"program": "${workspaceFolder}/dist/main.js",
"preLaunchTask": "tsc: build - tsconfig.json",
"outFiles": [
View create USER
var PouchDB = require('pouchdb');
PouchDB.plugin(require('pouchdb-authentication'));
//with Admin account
var dbUrl = encodeURI('https://mylogin:mypwd@myapp.cloudant.com/testaccess');
var db = new PouchDB(dbUrl, {skipSetup: true});
var options = {
metadata : {
email : 'robin@boywonder.com',
View test worker db.change
<div>
<html>
<head>
<meta charset="utf-8">
<title>Angular JS</title>
</head>
<body ng-app="myapp">
<div ng-controller="DemoCtrl as demo">
View leveldown verbose output
root@user:/srv/nodejs/testLevelDown# rm -rf node_modules/
root@user:/srv/nodejs/testLevelDown# npm install leveldown --verbose
npm info it worked if it ends with ok
npm verb cli [ '/usr/local/bin/node',
npm verb cli '/usr/local/bin/npm',
npm verb cli 'install',
npm verb cli 'leveldown',
npm verb cli '--verbose' ]
npm info using npm@3.6.0
npm info using node@v5.6.0
View $OR not working at all
{"$or":[{"name":"james"},{"name":"doe"}]}
@ronyrun
ronyrun / gist:b81b3ef51290439bceb5
Created Oct 30, 2015
error ==> no_usable_index: Database encountered an unknown error
View gist:b81b3ef51290439bceb5
var db = new PouchDB(cloudantURL);
db.createIndex({
index: {
fields: ['_id'],
name: 'addressesIndex',
ddoc: 'addressesddoc',
type: 'json'
}
})
@ronyrun
ronyrun / gist:4392763af97e3d788690
Created Oct 15, 2015
error from IOS / SAFARI with Cloudant.
View gist:4392763af97e3d788690
[Error] Failed to load resource: Request header field Authorization is not allowed by Access-Control-Allow-Headers. (email_2_5DD0964D-E433-4D57-8F57-4578039F4C70, line 0)
[Error] XMLHttpRequest cannot load https://myapp.cloudant.com/db(2e)eee(2e)pro(40)aze(2e)com/email_2_5DD0964D-E433-4D57-8F57-4578039F4C70?revs=true&open_revs=[%222-e4d38e9072e9c717b393b19979b80a02%22]. Request header field Authorization is not allowed by Access-Control-Allow-Headers.
[Error] Failed to load resource: The network connection was lost. (_revs_diff, line 0)
[Log] Sync onPause (console-via-logger.js, line 173)
PouchError
[Error] Failed to load resource: Request header field Authorization is not allowed by Access-Control-Allow-Headers. (_changes, line 0)
[Error] XMLHttpRequest cannot load https://myapp.cloudant.com/db(2e)eee(2e)pro(40)aze(2e)com/_changes?timeout=25000&style=all_docs&feed=longpoll&heartbeat=10000&filter=filters%2Fwafilter1&since=4719-g1AAAAEneJzLYWBgYMlgTmGQT0lKzi9KdUhJstTLSs1LLUst0kvOyS9NScwr0ctLLckBKmRKZEiy____
View charlotte2 _user
{
"_id": "org.couchdb.user:charlotte2",
"_rev": "1-26c282b6db1e1ad8af301b2589dedd28",
"password_scheme": "pbkdf2",
"iterations": 10,
"name": "charlotte2",
"type": "user",
"roles": [
"charlotte2",
"whenagainer"
View gist:2cc2192ca5d4c2fffcb3
var stream = window.memorystream;
PouchDB.plugin(replicationStream.plugin); //error here.
console.debug("stream",stream);
$q.all([
pouch.localDB.load(stream), //error here
pouch.remoteDB.dump(stream) // error here
]).then(function (res) {
console.log('stream Hooray the stream replication is complete!', res);
});
You can’t perform that action at this time.