This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"bytes" | |
"fmt" | |
"log" | |
badger "github.com/dgraph-io/badger/v4" | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# add to config/initializers/instrumentation.rb | |
module CouchRest | |
class Database | |
alias_method :old_get, :get | |
alias_method :old_view, :view | |
alias_method :old_update_doc, :update_doc | |
alias_method :old_delete_doc, :delete_doc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -e | |
rm -rf couchdb | |
git clone https://github.com/apache/couchdb.git | |
cd couchdb | |
echo "" | |
add_subtree () { | |
name=$1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"version": "0.2.0", | |
"configurations": [ | |
{ | |
"name": "Tests", | |
"type": "node", | |
"request": "launch", | |
"program": "${workspaceRoot}/node_modules/jest/bin/jest.js", | |
"stopOnEntry": false, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use serde_json; | |
macro_rules! query_type { | |
("fields" => $fields:expr) => {{ | |
println!("field {:?}", $fields); | |
"boom".to_string() | |
}}; | |
( | |
{$section:expr => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ab -c 35 -n 1000 http://127.0.0.1:8000/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%Replace from line 251 in couch_httpd_misc_handlers.erl | |
% httpd log handlers | |
handle_log_req(#httpd{method='GET'}=Req) -> | |
ok = couch_httpd:verify_is_server_admin(Req), | |
Bytes = list_to_integer(couch_httpd:qs_value(Req, "bytes", "1000")), | |
Offset = list_to_integer(couch_httpd:qs_value(Req, "offset", "0")), | |
Chunk = couch_log:read(Bytes, Offset), | |
case couch_httpd:qs_value(Req, "format", "text") of | |
"json" -> |
NewerOlder