This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'complex' | |
require 'matrix' | |
require 'chunky_png' | |
module Fractal | |
class Mandelbrot | |
class << self | |
# Returns the mandelbrot value after iterating over c | |
def mandelbrot(c, dim=2) | |
Array.new(100).inject(0) { |z,i| z ** dim + c } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'mechanize' | |
agent = Mechanize.new | |
agent.get('http://masteringcoding.com/') | |
results = agent.page.search('.teaser-title a') | |
results.each { |result| puts "#{result.text} (#{result.attributes['href']})" } |