Skip to content

Instantly share code, notes, and snippets.

View talhasyed's full-sized avatar

Talha Umer Syed talhasyed

View GitHub Profile
class GameOfLife
attr_accessor :state, :height, :width, :rules
def initialize options={}
self.rules = options[:rules] || [ [0,0,0,1,0,0,0,0,0], [0,0,1,1,0,0,0,0,0] ]
self.height = options[:size] || options[:height] || 10
self.width = options[:size] || options[:width] || 10
self.state = options[:seed] || grid { rand(2) }
defaults write com.macromates.textmate OakDefaultLanguage E00B62AC-6B1C-11D9-9B1F-000D93589AF6
require 'csv'
file = "db/commission_junction/2087028_18584_20080827.csv"
cols, *rows = CSV::Reader.parse(File.open(file)).to_a
collection = rows.collect { |row| Hash[*cols.zip(row).flatten] }
puts collection.first.inspect