Skip to content

Instantly share code, notes, and snippets.

Jan Lehnardt janl

Block or report user

Report or block janl

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View doppler-1.erl
fun({Doc}) ->
case {proplists:get_value(<<"id">>, Doc)} of
{undefined} ->
ok;
{Id} ->
Emit(Id, Doc);
_ ->
ok
end
end.
View mustache3.js
> 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:
View gist:552288

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

View gist:1058683
$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 Jul 5, 2011
CouchDB Meetup Berlin July
View gist:1064673
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!
View gist:1067238
<?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;
}
View gist:1116378
--- 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
View gist:1180828
> 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'
View gist:1180850
# 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
You can’t perform that action at this time.