Skip to content

Instantly share code, notes, and snippets.

View garrensmith's full-sized avatar

Garren garrensmith

View GitHub Profile
package main
import (
"bytes"
"fmt"
"log"
badger "github.com/dgraph-io/badger/v4"
)
// This is a follow on example from @bennadel blogpost https://www.bennadel.com/blog/3256-monkey-patching-the-mango-find-plugin-to-use-alldocs-in-pouchdb-6-2-0.htm
// This uses allDocs() with the keys selector to do a quick find for specific id's.
// It then uses pouchdb-selector-core to further filter the results. pouchdb-selector-core is the library that does the in-memory filtering
// for pouchdb-find and in the changes feed and with replication
// use pouchdb-browser here if you are running this in the browser
var PouchDB = require('pouchdb-node');
var selectors = require('pouchdb-selector-core');
#!/bin/bash -e
rm -rf couchdb
git clone https://github.com/apache/couchdb.git
cd couchdb
echo ""
add_subtree () {
name=$1
{
"version": "0.2.0",
"configurations": [
{
"name": "Tests",
"type": "node",
"request": "launch",
"program": "${workspaceRoot}/node_modules/jest/bin/jest.js",
"stopOnEntry": false,
use serde_json;
macro_rules! query_type {
("fields" => $fields:expr) => {{
println!("field {:?}", $fields);
"boom".to_string()
}};
(
{$section:expr => {
use std::fmt;
use hyper::Error as hyperError;
use std::error::Error as StdError;
use std::collections::HashMap;
use serde_json;
#[derive(Debug)]
pub struct Error {
pub error: String,
pub description: String
var db = new PouchDB('ddd');
db.bulkDocs([
{ name: 'Mario', _id: 'mario', rank: 5, series: 'Mario', debut: 1981, awesome: true },
{ name: 'Jigglypuff', _id: 'puff', rank: 8, series: 'Pokemon', debut: 1996,
awesome: false },
{ name: 'Link', rank: 10, _id: 'link', series: 'Zelda', debut: 1986, awesome: true },
{ name: 'Donkey Kong', rank: 7, _id: 'dk', series: 'Mario', debut: 1981, awesome: false },
{ name: 'Pikachu', series: 'Pokemon', _id: 'pikachu', rank: 1, debut: 1996, awesome: true },
{ name: 'Captain Falcon', _id: 'falcon', rank: 4, series: 'F-Zero', debut: 1990,

Fauxton components

We use many libraries to build Fauxton. Below are a list of the libraries that we use to make Fauxton. Having a decent understanding of these libraries will make it easier to contribute.

##Backbone.js

The main core library that is used to build Fauxton is Backbone.js. Backbone.js is a powerful and very small MVC library. Backbone.js on its own doesn't give us enough features that we need for Fauxton.

To give us some more features and structure, we combine Backbone.js with backbone.layoutmanager. Backbone.layoutmanager

{
"deps": [
{ "name": "fauxton" },
{ "name": "databases" },
{ "name": "documents" },
{ "name": "pouchdb" },
{ "name": "activetasks" },
{ "name": "config" },
{ "name": "stats" },
{ "name": "replication" },
{
"deps": [
{ "name": "fauxton" },
{ "name": "databases" },
{ "name": "documents" },
{ "name": "auth" }
],
"template": {
"development": {
"src": "assets/index.underscore",