Skip to content

Instantly share code, notes, and snippets.

View carlocasorzo's full-sized avatar

Carlo Casorzo carlocasorzo

View GitHub Profile
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 }
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']})" }