Skip to content

Instantly share code, notes, and snippets.

View southgate's full-sized avatar
🌏
Mars: overrated

Alex Southgate southgate

🌏
Mars: overrated
  • WorkOS
  • Lisbon, PT
  • 00:20 (UTC +01:00)
  • X @fromagie
View GitHub Profile
# is this not already provided somewhere?
# even_distribution?([50,49,53]) => true
# even_distribution?([50,33,70]) => false
def even_distribution?(array, slack = 0.1)
exact_distribution = 1 / array.size.to_f
slack_val = exact_distribution * slack
ceil = exact_distribution + slack_val
floor = exact_distribution - slack_val
total = array.reduce{ |v,t| v + t }.to_f
array.each do |element|
@southgate
southgate / gist:941465
Created April 25, 2011 23:17 — forked from kasima/gist:941464
Mongo Office Hours
class DiagnosticReport
include Mongoid::Document
embeds_many :marker_values
end
class MarkerValue
include Mongoid::Document
@southgate
southgate / .gitignore
Created May 11, 2011 21:55 — forked from karmi/.gitignore
Script to generate PDF cards suitable for planning poker from Pivotal Tracker [http://www.pivotaltracker.com/] CSV export. Inspired by Bryan Helmkamp's http://github.com/brynary/features2cards/. Support for Ruby 1.9 csv lib and prawn 0.11.1.
.DS_Store
*.csv
*.pdf