Skip to content

Instantly share code, notes, and snippets.

View dreverri's full-sized avatar

Daniel Reverri dreverri

View GitHub Profile
@dreverri
dreverri / gist:413660d57170ebb5c3e6400b33fe2af4
Created October 30, 2019 14:40
elm init fails in pure nix-shell on macos
~/tmp/elm-test ❯ nix-shell --pure -p yarn
~/tmp/elm-test via pure ❯ yarn install elm
yarn install v1.19.0
info No lockfile found.
error `install` has been replaced with `add` to add new dependencies. Run "yarn add elm" instead.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
~/tmp/elm-test via pure ❯ yarn add elm
yarn add v1.19.0
info No lockfile found.
[1/4] 🔍 Resolving packages...
@dreverri
dreverri / tf.libsonnet
Last active April 4, 2019 16:57
tf.libsonnet
{
local tf = self,
attribute:: function(name) function(r) std.format("${%s.%s.%s}", [r.type, r.name, name]),
argument:: function(name) function(value) { args+:: { [name]: value } },
id:: tf.attribute("id"),
new:: function(type) function(name) {
local resource = self,
type:: type,
name:: name,
args:: {},
local safeGet = function(name) function(o, default={}) if std.objectHas(o, name) then o[name] else default;
local metadata = safeGet("metadata");
local name = safeGet("name");
local namespace = safeGet("namespace");
local kind = safeGet("kind");
local kindPriority = std.foldl(function(o, k) o { [k]: std.length(o) }, [
"Namespace",
"ResourceQuota",
"LimitRange",
"PodSecurityPolicy",
-- Recursive Person example from https://github.com/dhall-lang/dhall-lang/wiki/How-to-translate-recursive-code-to-Dhall
-- Modified to work in a similar way to https://github.com/dhall-lang/dhall-lang/tree/gabriel/json_pure_dhall/Prelude/JSON
let Person =
∀(Person : Type)
→ ∀(mk : { name: Text, children: List Person } → Person)
→ Person
let map = https://prelude.dhall-lang.org/List/map
@dreverri
dreverri / fp.scala
Last active October 11, 2018 22:00
Experimenting with a different Typeclass encoding in Scala
object fp {
case class derived[a](a: a) {
def map[b](f: a => b): derived[b] = derived(f(a))
}
trait function { }
object function {
trait mappend[a] extends function { def apply(a1: a, a2: => a): a }
trait mempty[a] extends function { def apply: a }
trait imap[f[_]] extends function { def apply[a, b](fa: f[a])(f: a => b)(g: b => a): f[b] }
@dreverri
dreverri / pb_status_anon.txt
Created November 16, 2012 00:53 — forked from kellymclaughlin/pb_status_anon.txt
How to get poolboy status for each Riak Vnode
PBStatusFun = fun() ->
VnodePids = [Pid || {_, Pid} <- riak_core_vnode_manager:all_index_pid(riak_kv_vnode)],
Links = [process_info(Pid, [links]) || Pid <- VnodePids],
WorkerPoolPids = [WPPid || [{links,[_, WPPid]}] <- Links],
WorkerPoolLinks = [process_info(Pid, [links]) || Pid <- WorkerPoolPids],
PoolboyPids = [PoolboyPid || [{links,[_, PoolboyPid]}] <- WorkerPoolLinks],
[poolboy:status(Pid) || Pid <- PoolboyPids]
end.
PBStatusFun = fun(Index) ->

Issue 1

When saving an object with siblings Ripple saved the object with Content-Type set to multipart/mixed.

This has been fixed in v1.0.0beta2 by requiring Ripple documents to specify an on_conflict handler.

Steps to Reproduce

require 'ripple'
class Foo
include Ripple::Document
property :bar, String
end
Foo.bucket.allow_mult = true
curl -XPOST http://localhost:8098/mapred \
-H 'Content-Type: application/json' \
-d '{"inputs":"docs",
"query":[{"map":{"language":"erlang",
"source":"fun(Object, _KD, _A) ->
Key = riak_object:key(Object),
[[Key, 1]]
end."}}]}'
if [ ! $# == 2 ]; then
echo "Usage: $( basename $0 ) /path/to/bin/riak dest_dir"
exit
fi
src_riak_script="$1"
src_riak_root="$( cd -P "$( dirname "$1" )" && pwd )"
src_riak_admin_script="$src_riak_root/riak-admin"
src_riak_search_cmd="$src_riak_root/search-cmd"