Skip to content

Instantly share code, notes, and snippets.

@trappist
Created June 1, 2012 19:47
Show Gist options
  • Select an option

  • Save trappist/2854732 to your computer and use it in GitHub Desktop.

Select an option

Save trappist/2854732 to your computer and use it in GitHub Desktop.
def build_weights
twitter_weights.destroy_all
Variable.all.each do |var|
Scheme.all.each do |scheme|
hash = tweets_of_followers.send(var.name)
total = hash.values.sum
hash.each do |key,val|
twitter_weights.create(
:scheme => scheme,
:variable => var,
:value => key,
:weight => (val/total.to_f)
)
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment