Skip to content

Instantly share code, notes, and snippets.

@phaedryx
Last active December 16, 2015 02:49
Show Gist options
  • Select an option

  • Save phaedryx/5365382 to your computer and use it in GitHub Desktop.

Select an option

Save phaedryx/5365382 to your computer and use it in GitHub Desktop.

Revisions

  1. phaedryx revised this gist Apr 11, 2013. 1 changed file with 1 addition and 2 deletions.
    3 changes: 1 addition & 2 deletions lds_conference_bingo.rb
    Original file line number Diff line number Diff line change
    @@ -8,8 +8,7 @@
    talk_list = Nokogiri::HTML(open("http://www.lds.org/general-conference/sessions/#{year}/#{month}?lang=eng"))
    talk_list.css("a.print").each do |link|
    talk = Nokogiri::HTML(open(link.attributes["href"].value))
    talk.text.gsub(/\n/,'').gsub(/[[:punct:]]/,'').split(" ").map(&:downcase).each {|word| words[word] += 1}
    talk.text.gsub(/\n/,' ').gsub(/[[:punct:]]/,' ').split(' ').map(&:downcase).each {|word| words[word] += 1}
    end
    end
    end

  2. phaedryx created this gist Apr 11, 2013.
    15 changes: 15 additions & 0 deletions lds_conference_bingo.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,15 @@
    require 'nokogiri'
    require 'open-uri'

    words = Hash.new {|h,k| h[k] = 0}

    (1971..2013).each do |year|
    ["04","10"].each do |month|
    talk_list = Nokogiri::HTML(open("http://www.lds.org/general-conference/sessions/#{year}/#{month}?lang=eng"))
    talk_list.css("a.print").each do |link|
    talk = Nokogiri::HTML(open(link.attributes["href"].value))
    talk.text.gsub(/\n/,'').gsub(/[[:punct:]]/,'').split(" ").map(&:downcase).each {|word| words[word] += 1}
    end
    end
    end