Skip to content

Instantly share code, notes, and snippets.

@huezoaa
huezoaa / hola_miami.html
Created February 1, 2015 20:08
Hola Miami
<!DOCTYPE html>
<html>
<header>
<meta charset="UTF-8">
<title>Title goes here</title>
</header>
<body>
<h1>&iexcl;Hola Miami!</h1>
<h2>&Ccedil;a va?</h2>
@huezoaa
huezoaa / my_api.rb
Created January 30, 2015 22:00
Spell Check API
require 'httparty'
require 'json'
puts "Please enter the word to spell-check:"
##### Get word to spell check from the user
word = gets.chomp
address = "https://montanaflynn-spellcheck.p.mashape.com/check/?text=" + word
@huezoaa
huezoaa / curl_ruby.rb
Last active August 29, 2015 14:14
Ruby Curl
require 'httparty'
# puts ARGV
# p ARGV
#### Hint: When you pass arguments to Ruby through the Command Line,
#### they get set into a Constant Array variable named ARGV.
case ARGV[0]
when "GET"
@huezoaa
huezoaa / stock_ticker_bonus.rb
Created January 30, 2015 20:37
Stock Ticket Bonus
require 'HTTParty'
require 'json'
require 'nokogiri'
### Obtain stock symbol:
puts "Please enter your Stock Symbol:"
stock_symbol = gets.chomp
address = "http://finance.yahoo.com/q?s=" + stock_symbol
# puts address
@huezoaa
huezoaa / stock_ticker.rb
Created January 30, 2015 20:16
Stock Ticker
require 'HTTParty'
require 'json'
require 'nokogiri'
### run a GET from Yahoo with HTTParty for Apple Stock, assign to response
response = HTTParty.get('http://finance.yahoo.com/q?s=AAPL')
### take response body and use Nokogiri to parse the HTML into a Ruby variable
ticker = Nokogiri::HTML(response.body)
@huezoaa
huezoaa / votersim_classes.rb
Created January 26, 2015 22:04
voter sim classes
# Super Class Voter.
# Class variables:
#
module VoterSimClasses
class Voter
attr_accessor :name, :id, :type
def initialize
@huezoaa
huezoaa / votersim_main.rb
Created January 26, 2015 22:03
voter simulation main
require "./votersim_classes.rb"
include VoterSimClasses
def greet_and_choose
puts "\n\n\n\n\n\n\n\n\n\n"
puts "What would you like to do????"
puts "Create, List, Update, Vote, or Exit"
gets.chomp.downcase
end
@huezoaa
huezoaa / christmas_tree_class.rb
Last active August 29, 2015 14:13
Christmas Tree w/ Class
# Dislays the specified character in the shape of a
# Christmas tree.
# Wyncode bootcamp. Ruby Classes and OOP
# Arguments for Christmas tree:
# size = number of lines (Fixnum)
# character = string character to use (String)
class ChristmasTree
def initialize(size=3, character="X")
@huezoaa
huezoaa / game_mo_memory.rb
Created January 19, 2015 17:36
mo_memory
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!
@huezoaa
huezoaa / max_refactor.rb
Created January 18, 2015 20:26
Max Refactor
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)