{{ message }}

Instantly share code, notes, and snippets.

# Angel Huezo huezoaa

• Miami, FL
Created Jan 13, 2015
hello_world
View hello_world.rb
 puts "hello world!"
Last active Aug 29, 2015
wyncode.rb
View wyncode.rb
 # My favorite questions from the Wyncode Ruby Units # #UNIT: Ruby syntax. puts "Ruby Syntax: Float Money" puts <
Created Jan 14, 2015
Game_on
View game_on.rb
 puts <> Beta version(01.14.2015)
Last active Aug 29, 2015
 # Add 2 to the number. def add_two(number) if number.respond_to? :+ if number.respond_to? :push number.push 2 elsif number.respond_to? :upcase # Your entry is must be a String number + "2" else number + 2
Last active Aug 29, 2015
 def max(num1, num2) num1 > num2 ? num1 : num2 end def test # Assume all entries are numeric p max(1,2) == 2 # (Fixnum, Fixnum) p max(2,1) == 2 # (Fixnum, Fixnum) p max(0.1, 0.2) == 0.2 # (Float, Float) p max(0.2, 0.1) == 0.2 # (Float, Float) p max(1,1.1) == 1.1 # (Fixnum, Float)
Last active Aug 29, 2015
Happy New Year Countdown
View countdown.rb
 # Homework assignment. Ruby Methods 2. # Question #1 def countdown(n=10) (0..n).each { |count| p (n-count) != 0 ? "#{n-count}" : "Happy New Year!" # Because .each returns an array that can't be indexed, # p will print each element as it gets created # by the loop. But "print" waits unitl the array is complete to spit it out!
Last active Aug 29, 2015
FizzBuzz
View fizzbuzz.rb
 # Method fizzbuzz will have a default num parameter of 15 # so if I call it by mistake without passing a value, it will return # "fizzbuzz" and I will know where to look in my code. def fizzbuzz(num=15) # Check for the most intricate condition first! if (num % 3 == 0) and (num % 5 == 0) puts "FizzBuzz!!!!!!"
Created Jan 18, 2015
Max Refactor
View max_refactor.rb
 def max(num1, num2, *num) num1 > num2 ? num1 : num2 end def test # Assume all entries are numeric p max(1,9,3,5,99,23,115,32,922,3983,38374,28474,10937134) == 9 p max(1,2) == 2 # (Fixnum, Fixnum) p max(2,1) == 2 # (Fixnum, Fixnum) p max(0.1, 0.2) == 0.2 # (Float, Float) p max(0.2, 0.1) == 0.2 # (Float, Float)
Created Jan 19, 2015
mo_memory
View game_mo_memory.rb
 mo = [] #The computer's sequence of lights. #Does not clear through execution your_entry = [] #The player's sequence of lights. Clears on every loop level = 0 #Counter that increases with every loop. #used to display level and add new index to mo array. while mo == your_entry # Will run until player makes a mistake print "\033c" # This clears the screen!
Last active Sep 22, 2015
ah_lecture_notes_01-20-2015
View ah_lecture_notes.rb
 require 'csv' class ConfPanel < ActiveRecord::Base validates :code, presence: true validates :name, presence: true def self.import_from_csv(csv_file) ConfPanel.transaction do ConfPanel.destroy_all # Parse CSV content