Skip to content

Instantly share code, notes, and snippets.

View reiddraper's full-sized avatar
🍹

Reid Draper reiddraper

🍹
View GitHub Profile

Some thoughts...

  1. What about putting the type in the Content-Type field? Something like x-crdt-g-set-v1
  2. What's the rationale for representing things as a hash with lists as values instead of two hashes (in the OR and LWW set for example)? This to me seems closer to how it'll be represented in code (or at least how I've chosen to do with knockbox).

On JSON vs. Protobuf:

JSON has the advantage of easily being used in the browser, so you could actually use the browser's timestamp for some of the operations. This can be useful if for a single key, the single browser is the main actor doing writes. JSON also works easily with javascript mapreduce. If size is a concern, I'd be curious to see the size difference between compressed (snappy maybe?) JSON and Protobuf. I'm not saying Protobuf is a bad choice, just things to consider.

@reiddraper
reiddraper / core.clj
Created February 12, 2012 20:38
async IO + thread pool
(ns chat.core
(:use lamina.core aleph.tcp gloss.core)
(:gen-class))
(def broadcast-channel (permanent-channel))
(defn chat-handler [ch client-info]
(receive-all ch #(async (let [value (if (not= "sleep" %)
%
(task (do (Thread/sleep 5000) "I slept!")))]
(use 'clojure.core.logic)
(defne all-in [x mems]
([[?a . ?b] mems]
(membero ?a mems)
(all-in ?b mems))
([() _]))
(defrel cocktail n)
(fact cocktail :martini)
@reiddraper
reiddraper / question.markdown
Created March 25, 2012 20:10
Understanding Performance and Constraints in core.logic

Clojure 1.3.0 core.logic 0.6.8

This is the base code for which all the run calls use.

(use 'clojure.core.logic)

(defne all-in [x mems]
call pathogen#runtime_append_all_bundles()
set nocompatible
set list
set scroll=6
set scrolloff=999
set softtabstop=4
(require '[crosscram.core :as crosscram] :reload)
(require '[clojure.core.match :as match])
(require '[clojure.set :as set])
(require 'clojure.pprint)
(defn move [game]
(let [rows (:rows game)
columns (:columns game)]
(loop [moves (match/match (:next-player game)
:horizontal (crosscram/generate-horizontal rows columns)

Riak Users,

I've been working on some new features for Riak's secondary indexes (2i), and I wanted to get some feedback from the community before proceeding much further.

How does 2i work currently?

2i lets you query index values with

I've been playing more with this Erlang factoring technique. As an exercise, I've been trying to force myself to adopt the method, by writing functions that are 3 or less lines long (function clauses actually, so multiple pattern-matched claues are OK).

Death to receive expressions

One place I noticed was causing myself

on the guest SmartOS VM

pkg_add http://pkgsrc.joyent.com/sdc6/2012Q1/i386/All/smtools
# note this is going to shut down the VM
sm-prepare-image

on the global zone

@reiddraper
reiddraper / fsm.markdown
Created August 17, 2012 19:20
FSM Strawman

FSM Strawman

I've been thinking about some of the shortcomings of gen_fsm, and some common FSM actions I've either implemented myself, or seen my FSMs suffer from not having. I've been playing around with a couple ideas for alternative ways to describe an FSM that would still be driven by gen_fsm. This is the the first concrete idea I've come up with, but it certainly still is far from completely fleshed out. That said, I think there's enough to start getting feedback.