This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<script src="name.js"></script> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<form> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module EqualL | |
def side | |
@side1 | |
end | |
end | |
class Quadrilateral | |
def initialize(side1, side2, side3, side4) | |
@side1 = side1 | |
@side2 = side2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
a = (Object.methods).sort + (Kernel.methods).sort + (BasicObject.methods).sort | |
puts a.sort.uniq |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def max_refactor (*rest) | |
puts rest.max | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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 } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
NewerOlder