Skip to content

Instantly share code, notes, and snippets.

View tlehman's full-sized avatar

Tobi Lehman tlehman

View GitHub Profile
# http://www.evanmiller.org/bayesian-ab-testing.html implemented in ruby
# requires the distribution gem from https://github.com/clbustos/distribution (gem 'distribution', require: false)
def probability_b_beats_a(completed_a, total_a, completed_b, total_b)
require 'distribution/math_extension'
total = 0.0
alpha_a = completed_a + 1
beta_a = total_a - completed_a + 1
alpha_b = completed_b + 1
@tlehman
tlehman / README.md
Created February 10, 2016 19:18 — forked from quiver/README.md
Who says PostgreSQL can't Pub/Sub like Redis?

Pub/Sub pattern with PostgreSQL's LISTEN/NOTIFY command

This is a simple chat-like program using pub-sub pattern, backed by PostgreSQL's LISTEN/NOTIFY command.

Publish

publish message to foo channel from user nickname.

$ python pub.py foo nickname
PUBLISH to channel #foo
@tlehman
tlehman / classes.rb
Last active December 20, 2015 22:48 — forked from sferik/classes.rb
graph = {}
ObjectSpace.each_object(Class) do |klass|
sup = klass.superclass and graph[klass] = sup
end
puts "digraph{overlap=false;"
graph.map do |key, value|
puts %("#{key}"\n"#{key}"->"#{value}")
end
puts"}"
#!/bin/bash
function today {
echo `date +"%Y%m%d"`
}
function last_tag_today {
output=`git tag`
local last_today=''