Skip to content

Instantly share code, notes, and snippets.

View janl's full-sized avatar
🛋️
Drop ICE

Jan Lehnardt janl

🛋️
Drop ICE
View GitHub Profile
var till = "awesome";
fun({Doc}) ->
case {proplists:get_value(<<"id">>, Doc)} of
{undefined} ->
ok;
{Id} ->
Emit(Id, Doc);
_ ->
ok
end
end.
> rake
(in /Users/jan/Work/mustache.js)
..FFFFFFFFFFFF....FFF.F.FFFFFFFFFF.F.FFFFFFFFFFFFFFFFFFF
1)
'mustache array_of_strings should generate the correct html' FAILED
expected: "hello world \n",
got: "\n hello world \n" (using ==)
./test/mustache_spec.rb:71:
@janl
janl / gist:552288
Created August 26, 2010 21:24 — forked from mikeal/gist:552181

Using CouchDB with node.js

First, get yourself a CouchDB! You can get a free hosted CouchDB in seconds or download a binary from the Couchio downloads page.

Next, install npm because all awesome node packages are in npm :)

Node has better support for HTTP than any language I've ever worked with and coincidentally CouchDB's interface is solely accessible via HTTP. First, let's just talk to CouchDB using an HTTP library and later we'll look at some higher level abstractions.

Talking to CouchDB using request

$query = $this->cb->queries("name");
Couchbase_QueryOptions $options = array(
"limit" => false,
"skip" => 0,
"descending" => false,
"stale" => false,
"group" => false,
"group_level" => 0,
"reduce" => true,
@janl
janl / gist:1064673
Created July 5, 2011 11:26
CouchDB Meetup Berlin July
Hey,
we are going to meet at http://co-up.de on Wednesday July 13th, 19:00.
We don't have a special talk yet, let me (@janl) know if you'd like to present anything.
In lieu of a talk, I'd suggest we'll have an open discussion round. I'm happy to answer any questions you might have around CouchDB or Couchbase.
Also, drinks afterwards!
<?php
$cb = new Couchbase;
$cb->addServer("localhost", 11211); // BC compat
$view = $cb->getView("ddocname", "viewname"); // returns Couchbase_View
$result = $view->getResult(); // returns Couchbase_ViewResult
foreach($result->rows AS $row) {
echo $row->value;
}
--- lib/gvc/Makefile.am.orig 2011-06-26 03:07:07.000000000 -0700
+++ lib/gvc/Makefile.am 2011-06-26 03:07:27.000000000 -0700
@@ -55,7 +55,6 @@ libgvc_C_la_DEPENDENCIES += $(top_build
endif
if ENABLE_LTDL
-libgvc_C_la_LIBADD += $(LIBLTDL) $(LIBLTDL_LDFLAGS)
+libgvc_C_la_LIBADD += @LIBLTDL@ $(LIBLTDL_LDFLAGS)
-libgvc_C_la_DEPENDENCIES += $(LIBLTDL)
endif
> cat Library/Formula/erlang.rb
require 'formula'
class ErlangManuals < Formula
url 'http://erlang.org/download/otp_doc_man_R14B03.tar.gz'
md5 '357f54b174bb29d41fee97c063a47e8f'
end
class ErlangHtmls < Formula
url 'http://erlang.org/download/otp_doc_html_R14B03.tar.gz'
# no args
brew install erlang
# no env var
> echo $HOMEBREW_BUILD_FROM_SOURCE
# Lion
> uname -a
Darwin rose.local 11.0.1 Darwin Kernel Version 11.0.1: Thu Jul 28 02:01:39 PDT 2011; root:xnu-1699.23.4~1/RELEASE_X86_64 x86_64