Skip to content

Instantly share code, notes, and snippets.

12:37 <Baz___> Specifically, I have ratings ({ accountID, itemID, rating }) and am trying to find out how many times pairs of users rated the same items: [{ accountID1, accountID2, numTimesRatedSameItem }]
map:
emit([doc.itemID, doc.accountID]);
reduce:
var permute = function(arr) {
// return an array of every pair of values in arr,
[url "https://github.com/"]
insteadOf = "git://github.com/"
pushInsteadOf = "git://github.com/"
[url "https://github.com/"]
insteadOf = "[email protected]:"
pushInsteadOf = "[email protected]:"
Last login: Thu Aug 14 17:17:56 on ttys001
cur% ➜ ~ curl localhost:5984/db1 -XPUT
{"ok":true}
➜ ~ curl localhost:5984/db1/foo+bar -XPUT -d{}
{"ok":true,"id":"foo bar","rev":"1-967a00dff5e02add41819138abb3284d"}
➜ ~ curl localhost:5984/db1/foo%2bbar -XPUT -d{}
{"ok":true,"id":"foo+bar","rev":"1-967a00dff5e02add41819138abb3284d"}
➜ ~ curl localhost:5984/db1/foo%2bbar
{"_id":"foo+bar","_rev":"1-967a00dff5e02add41819138abb3284d"}
➜ ~ curl localhost:5984/db1/_changes
diff --git a/src/ioq.erl b/src/ioq.erl
index b2be7bf..b863a20 100644
--- a/src/ioq.erl
+++ b/src/ioq.erl
@@ -12,10 +12,14 @@
-module(ioq).
-behaviour(gen_server).
+-behaviour(config_listener).
@rnewson
rnewson / couchdb.rb
Created July 21, 2014 20:59
overwrite default.ini after install
diff --git a/Library/Formula/couchdb.rb b/Library/Formula/couchdb.rb
index c77e70c..258140b 100644
--- a/Library/Formula/couchdb.rb
+++ b/Library/Formula/couchdb.rb
@@ -59,6 +59,25 @@ class Couchdb < Formula
(var+'log/couchdb').mkpath
end
+ def post_install
+ if new_default_ini.exist?
Couchdb 1.5.1 install
> grep util_driver_dir /usr/local/etc/couchdb/*
/usr/local/etc/couchdb/default.ini:util_driver_dir = /usr/local/Cellar/couchdb/1.5.1/lib/couchdb/erlang/lib/couch-1.5.1/priv/lib
brew upgrade
> grep util_driver_dir /usr/local/etc/couchdb/*
/usr/local/etc/couchdb/default.ini:util_driver_dir = /usr/local/Cellar/couchdb/1.5.1/lib/couchdb/erlang/lib/couch-1.5.1/priv/lib
/usr/local/etc/couchdb/default.ini.default:util_driver_dir = /usr/local/Cellar/couchdb/1.6.0/lib/couchdb/erlang/lib/couch-1.6.0/priv/lib
#!/usr/bin/env escript
main(Path) ->
{ok, Fd} = file:open(Path, [binary, read, raw]),
Count = count_headers(Fd),
file:close(Fd),
io:format("~s contains ~B headers.~n", [Path, Count]).
count_headers(Fd) ->
count_headers(Fd, 0, 0).
couchdb git:(master) curl foo:bar@localhost:15986/db1/_design/foo/_view/bar -d '{"queries": [ {"key":"doc1"} , {"key":"doc1"} ]}'
{"results":[
{"total_rows":1,"offset":0,"rows":[
{"id":"doc1","key":"doc1","value":null}
]},
{"total_rows":1,"offset":0,"rows":[
{"id":"doc1","key":"doc1","value":null}
]}
]}
[couchdb]
util_driver_dir = /home/USER/lib
< HTTP/1.1 200 OK
< X-CouchDB-Body-Time: 0
< X-Couch-Request-ID: 31ca484b
* Server CouchDB/c10fe5e (Erlang OTP/R14B01) is not blacklisted
< Server: CouchDB/c10fe5e (Erlang OTP/R14B01)
< Date: Mon, 07 Jul 2014 10:32:26 GMT
< Content-Type: text/plain; charset=utf-8
< Content-Length: 16
< Cache-Control: must-revalidate
<