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
ObjToPut = riakc_obj:update_value(Obj, | |
term_to_binary(Stuff)), | |
case riakc_pb_socket:put(DS, ObjToPut, [{w, 3}]) of | |
ok -> | |
error_logger:info_report({created_stuff}), | |
ok; | |
Reason -> | |
{error, Reason} | |
end. |
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
% using goog data import from the "fast track" | |
Merge = fun(VL, _A) -> | |
[ lists:foldl(fun(X, Acc) -> X + Acc end, 0, VL) ] | |
end. | |
Length = fun(G, _X, _Y) -> | |
[ erlang:byte_size(riakc_obj:get_value(G)) ] | |
end. |
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
109> Merge = fun(VL, _A) -> | |
109> [ lists:foldl(fun(X, Acc) -> X + Acc end, 0, VL) ] | |
109> end. | |
#Fun<erl_eval.12.113037538> | |
110> | |
110> Length = fun(G, _X, _Y) -> | |
110> [ size(riakc_obj:get_value(G)) ] | |
110> end. | |
#Fun<erl_eval.18.105910772> | |
111> |
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
Merge = fun(VL, _A) -> | |
[ lists:foldl(fun(X, Acc) -> X + Acc end, 0, VL) ] | |
end. | |
Length = fun(G, _X, _Y) -> | |
[ size(riak_object:get_value(G)) ] | |
end. | |
Identity = fun(G, _X, _Y) -> | |
[ riak_object:get_value(G) ] |
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
[orange] riak/dev: cat map-ex.json | |
{"inputs":[["goog","2010-01-04"], | |
["goog","2010-01-05"], | |
["goog","2010-01-06"], | |
["goog","2010-01-07"], | |
["goog","2010-01-08"]], | |
"query":[{"map":{"language":"erlang", | |
"source":"fun(G, _, _) -> | |
O = [riak_object:get_value(G)], |
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
if RUBY_VERSION == "1.9.2" | |
require 'open3' | |
else | |
require 'win32/open3' | |
end |
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
$ ./start_with_and_index.rb | |
user system total real | |
index fail 0.420000 0.000000 0.420000 ( 0.424444) | |
start_with? fail 0.990000 0.000000 0.990000 ( 0.993577) | |
index pass 0.420000 0.000000 0.420000 ( 0.424240) | |
start_with? pass 1.650000 0.020000 1.670000 ( 1.672174) |
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
myfun = Proc.new do | |
"hi" | |
end | |
myfun.call |
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
# Cookbook Name:: openldap | |
# Attributes:: openldap | |
# | |
# Copyright 2008-2009, Opscode, Inc. | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 |
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
YUI_JAR = File.dirname(__FILE__) + "/../tools/yuicompressor-2.4.2.jar" | |
class YuiCompressor < Nanoc3::Filter | |
identifier :yui_compress | |
type :text => :binary | |
def run(content, params={}) | |
type = type_from_extension | |
cmd = "java -jar #{YUI_JAR} --type #{type} -o #{output_filename}" | |
IO.popen(cmd, 'w') { |f| f.write(content) } | |
raise "yuicompressor exited with #{$?} for '#{cmd}'" unless $? == 0 |