Skip to content

Instantly share code, notes, and snippets.

View calvinmetcalf's full-sized avatar

Calvin Metcalf calvinmetcalf

View GitHub Profile
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
</head>
<body>
<script>
var body = document.getElementsByTagName('body')[0];
function log(msg) {
!function(e){if("object"==typeof exports)module.exports=e();else if("function"==typeof define&&define.amd)define(e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.PouchDB=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){
"use strict";
var utils = _dereq_('./utils');
var merge = _dereq_('./merge');
var errors = _dereq_('./deps/errors');
var EventEmitter = _dereq_('events').EventEmitter;
var upsert = _dereq_('./deps/upsert');
/*
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
</head>
<body>
<script src="pouchdb.js"></script>
<script>
var body = document.getElementsByTagName('body')[0];
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
</head>
<body>
<script src="pouchdb.js"></script>
<script>
var body = document.getElementsByTagName('body')[0];
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
'use strict';
var Readable = require('readable-stream').Readable;
var PouchDB = require('pouchdb');
var through = require('through2').obj;
var Chance = require('chance');
var inherits = require('inherits');
inherits(RandomStream, Readable);
function RandomStream(number) {
Readable.call(this, {objectMode: true});
this.chance = new Chance();
var start = document.getElementById('start');
var stuff = document.getElementById('stuff');
var remote = new PouchDB('https://skimdb.npmjs.com/registry');
var local = new PouchDB('npm');
start.addEventListener('click', function (){
remote.info().then(function (a) {
return a.doc_count;
}).then(function (count) {
remote.replicate.to(local, {
batch_size: 100