```ruby
Dir[ARGV[1] || 'algorithms/**/*.md'].each do |filename|
  matcher = File.read(filename).match(/~~~\n(require 'rspec'\n.+?)\n~~~/m)

  next if matcher.nil?

  puts "Evaluating #{filename}"
  matcher.captures.each { |capture| eval capture }
end```

Simplify spec helper even further and use scan so that we can evaluate all snippets in a file.
user
```ruby
Dir[ENV['MD'] || 'algorithms/**/*.md'].each do |filename|
  File.read(filename).scan(/~~~\n(require 'rspec'\n.+?)\n~~~/m).flatten.each_with_index do |snippet, i|
    puts "Evaluating #{i + 1} snippet in #{filename}"
    eval snippet
  end
end```
assistant