Skip to content

Instantly share code, notes, and snippets.

View joelreymont's full-sized avatar

Joel Reymont joelreymont

View GitHub Profile
/**
FIXME: Box exists to prevent the "Unimplemented IR generation feature non-fixed multi-payload enum layout" error. */
final class Box<T> {
let value: T
init(_ value: T) {
self.value = value
}
}

http://wagerlabs.com/about

Summary

I develop backends in Erlang and Go. I also write Mac device drivers and firmware for various microcontrollers.

I wrote OpenPoker, a scalable Erlang poker server, and sold it to Electronic Arts for use in EA World Series of Poker (WSOP).

I thrive on solving difficult problems.

// xcrun clang++ -std=c++11 -stdlib=libc++
#include <tuple>
#include <iostream>
using namespace std;
tuple<int, int> minmax(int x, int y)
{
if (x <= y)
@joelreymont
joelreymont / subman.sql
Created April 30, 2012 20:30
Mix SQL from a real project
CREATE TABLE Subman_Publisher
(
id string AUTO PRIMARY KEY, -- auto-generated, uuid
stacks set of string REFERENCES Subman_Stack, -- primary key ref
subscription_count int
);
CREATE TABLE Subman_Stack
(
@joelreymont
joelreymont / example.sql
Created April 9, 2012 22:55
Mix in action, with triggers, type specs, etc.
CREATE TABLE Publisher
(
id string AUTO PRIMARY KEY, -- auto-generated, uuid
stacks set of string REFERENCES Stack, -- primary key ref
subscription_count int -- Subscription.stack.publisher.id
);
CREATE TABLE Stack
(
id string AUTO PRIMARY KEY,
@joelreymont
joelreymont / twitter_stream.erl
Created November 7, 2011 20:16 — forked from gdamjan/twitter_stream.erl
twitter stream : ibrowse + json_stream_parse + mochiweb
-module(twitter_stream).
-author("[email protected]").
%% Depends on:
%% ibrowse for http
%% couchbeam for couchbeam_json_stream (a fork of damienkatz json_stream_parse)
%% mochiweb for mochiweb_util:urlencode
-export([start/0]).
(defmacro read-foreign (foreign-type buffer index)
(let ((size (fli:size-of foreign-type)))
`(let ((index ,index))
(fli:with-dynamic-foreign-objects ((value ,foreign-type))
(fli:with-coerced-pointer (bytes :type '(:unsigned :char)) value
(dotimes (byte-index ,size)
(let ((endian-byte-index #+LITTLE-ENDIAN byte-index
#-LITTLE-ENDIAN (- (1- limit) byte-index)))
(setf (fli:dereference bytes :index endian-byte-index)
(aref ,buffer index)))
%%%% Copyright (C) 2005-2008 Wager Labs, SA
%%%%
%%%% THE WORK (AS DEFINED BELOW) IS PROVIDED UNDER THE TERMS OF THIS
%%%% CREATIVE COMMONS PUBLIC LICENSE ("CCPL" OR "LICENSE"). THE WORK IS
%%%% PROTECTED BY COPYRIGHT AND/OR OTHER APPLICABLE LAW. ANY USE OF
%%%% THE WORK OTHER THAN AS AUTHORIZED UNDER THIS LICENSE OR COPYRIGHT
%%%% LAW IS PROHIBITED.
%%%%
%%%% BY EXERCISING ANY RIGHTS TO THE WORK PROVIDED HERE, YOU ACCEPT
%%%% AND AGREE TO BE BOUND BY THE TERMS OF THIS LICENSE. TO THE EXTENT
@joelreymont
joelreymont / calc.erl
Created July 30, 2011 16:17
Simple calculator kata in Erlang
-module(calc).
-export([calc/1]).
-include_lib("eunit/include/eunit.hrl").
calc(<<"">>) ->
0;
calc(Input)
@joelreymont
joelreymont / calc.erl
Created July 30, 2011 16:15
Simple calculator kata in Erlang
-module(calc).
-export([calc/1]).
-include_lib("eunit/include/eunit.hrl").
calc(<<"">>) ->
0;
calc(Input)