Skip to content

Instantly share code, notes, and snippets.

@timrogers
Last active August 29, 2015 14:21
Show Gist options
  • Select an option

  • Save timrogers/d1d60a954ce6a03d8a60 to your computer and use it in GitHub Desktop.

Select an option

Save timrogers/d1d60a954ce6a03d8a60 to your computer and use it in GitHub Desktop.

Revisions

  1. Tim Rogers revised this gist May 21, 2015. 1 changed file with 7 additions and 2 deletions.
    9 changes: 7 additions & 2 deletions test_me_on.rb
    Original file line number Diff line number Diff line change
    @@ -6,10 +6,15 @@
    authors = %w(foo bar baz)

    def test_me_on(authors)
    starred = []

    authors.shuffle.each_with_index do |author, index|
    puts "#{index + 1}/#{authors.count}. #{author}"
    authors.push(author) if $stdin.gets.chomp == "*"
    starred.push(author) if $stdin.gets.chomp == "*"
    end


    puts "*** And now for some of them again... ***\n"
    test_me_on(starred)

    puts "*** All done! ***"
    end
  2. Tim Rogers revised this gist May 21, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion test_me_on.rb
    Original file line number Diff line number Diff line change
    @@ -8,7 +8,7 @@
    def test_me_on(authors)
    authors.shuffle.each_with_index do |author, index|
    puts "#{index + 1}/#{authors.count}. #{author}"
    gets
    authors.push(author) if $stdin.gets.chomp == "*"
    end

    puts "*** All done! ***"
  3. Tim Rogers revised this gist May 21, 2015. 1 changed file with 7 additions and 0 deletions.
    7 changes: 7 additions & 0 deletions test_me_on.rb
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,10 @@
    # Load the authors from a text file of names, with one on each line...
    path = ARGV[0]
    authors = File.read(path).lines

    # ...or just define them inline
    authors = %w(foo bar baz)

    def test_me_on(authors)
    authors.shuffle.each_with_index do |author, index|
    puts "#{index + 1}/#{authors.count}. #{author}"
  4. Tim Rogers created this gist May 21, 2015.
    8 changes: 8 additions & 0 deletions test_me_on.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,8 @@
    def test_me_on(authors)
    authors.shuffle.each_with_index do |author, index|
    puts "#{index + 1}/#{authors.count}. #{author}"
    gets
    end

    puts "*** All done! ***"
    end