Skip to content

Instantly share code, notes, and snippets.

View verdi327's full-sized avatar
💭
Thinkful EI

Michael Verdi verdi327

💭
Thinkful EI
View GitHub Profile
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/Users/michaelverdi/.rvm/rubies/ree-1.8.7-2011.12/bin/ruby extconf.rb
checking for libxml/parser.h... yes
checking for libxslt/xslt.h... yes
checking for libexslt/exslt.h... yes
checking for iconv_open() in iconv.h... no
checking for iconv_open() in -liconv... yes
checking for xmlParseDoc() in -lxml2... yes
checking for xsltParseStylesheetDoc() in -lxslt... yes
@verdi327
verdi327 / gist:3222591
Created August 1, 2012 01:46
Class Extension Mixin
module CheckedAttributes
def self.included(base)
base.extend ClassMethods
end
module ClassMethods
def attr_checked(attribute, &validation)
define_method "#{attribute}=" do |value|
raise 'Invalid attribute' unless validation.call(value)
instance_variable_set("@#{attribute}", value)
class GuessingGame
def initialize(answer)
@answer = answer
@solved = false
end
def guess(number)
return "Answer is already known" if @solved
if number > @answer
:high
#InvoiceItem Class
def self.filter_by_item(item_id)
InvoiceItem.all_successful.select { |ii| ii.item_id == item_id }
end
def self.revenue_per_item(item_id)
filter_by_item(item_id).collect { |ii| ii.unit_price * ii.quantity }.inject(:+)
end
class Encryptor
def cipher(rotation)
characters = (' '..'z').to_a
rotated_characters = characters.rotate(rotation)
Hash[characters.zip(rotated_characters)]
end
def encrypt_letter(letter,rotation)
lowercase_letter = letter.downcase
cipher_for_rotation = cipher(rotation)
@verdi327
verdi327 / gist:5415969
Created April 18, 2013 20:30
news_screenshot
function newspaper(name, left, top, width, height) {
this.name = name;
this.left = left;
this.top = top;
this.width = width;
this.height = height;
}
var nyTimes = new newspaper('nytimes', 200, 440, 1400, 800);
var laTimes = new newspaper('latimes', 500, 200, 1000, 900);
function newspaper(name, left, top, width, height) {
this.name = name;
this.left = left;
this.top = top;
this.width = width;
this.height = height;
}
var nyTimes = new newspaper('nytimes', 200, 440, 1400, 800);
var laTimes = new newspaper('latimes', 500, 200, 1000, 900);
@verdi327
verdi327 / gist:5473883
Last active December 16, 2015 17:58
fizzbuzz..with a Proc!
fizzbuzz = Proc.new do |n|
if n % 15 == 0
puts "fizzbuzz"
elsif n % 3 == 0
puts "fizz"
elsif n % 5 == 0
puts "buzz"
else
puts n
end
1
mission statement
why program
intros - kids
why pomo
2
instructor intro
pbj
@verdi327
verdi327 / gist:5498191
Created May 1, 2013 20:40
roasted tomato soup
Main ingredients
6 tomatoes (roma, beefsteak, w/e)
3 carrots
2 bulbs of garlic
1 bag frozen corn
1 medium onion
random stuff
olive oil
veggie broth