Skip to content

Instantly share code, notes, and snippets.

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script src="name.js"></script>
<title>JS Bin</title>
</head>
<body>
<form>
require 'httparty'
require 'nokogiri'
puts "Enter a stock ticker you would like to"
stock = gets.chomp.downcase
response = HTTParty.get("http://finance.yahoo.com/q?s=#{stock}")
dom = Nokogiri::HTML(response.body)
se = dom.xpath("//span[@id='yfs_l84_#{stock}']").first
require 'unirest'
puts "Please enter you city to find out the highs for the week"
city = gets.chomp.downcase
response = Unirest.get "https://george-vustrey-weather.p.mashape.com/api.php?location=#{city}",
headers:{'X-Mashape-Key'=> "17ECFHpjXjmshRDL0utKUrvKjcj6p1Yrg9TjsnJfGjy3okl7rq", 'Content-Type'=> "application/x-www-form-urlencoded"}
weather = response.body
weather.each {|x|
day_of_week = x["day_of_week"]
module WyncodeMethods
def self.convert_the_letter_A_into_a_Fixnum(s, *rest)
s.to_i if s.respond_to? :to_i
end
def self.convert_to_interger(n, *rest)
n.to_i if n.respond_to? :to_i
end
module EqualL
def side
@side1
end
end
class Quadrilateral
def initialize(side1, side2, side3, side4)
@side1 = side1
@side2 = side2
puts "String To Number"
puts "'A'.to_i"
puts "\n"
def convert_the_letter_A_into_a_Fixnum(s, *rest)
s.to_i if s.respond_to? :to_i
end
puts "Test Results"
def test_convert_the_letter_A_into_a_Fixnum
puts convert_the_letter_A_into_a_Fixnum("A") == 0
a = (Object.methods).sort + (Kernel.methods).sort + (BasicObject.methods).sort
puts a.sort.uniq
def max_refactor (*rest)
puts rest.max
end
(1..100).each {|i|
if i % 3 == 0 and i % 5 != 0
i = "Fizz"
elsif i % 5 == 0 and i % 3 != 0
i = "Buzz"
elsif i % 3 == 0 and i % 5 == 0
i = "FizzBuzz"
end
puts i }
def add_two(number)
if number.respond_to? :+
if number.respond_to? :push
number.push 2
elsif number.class == String
number + "2"
else
number + 2
end