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
states = { | |
"AL" => "Alabama", | |
"AK" => "Alaska", | |
"AS" => "American Samoa", | |
"AZ" => "Arizona", | |
"AR" => "Arkansas", | |
"CA" => "California", | |
"CO" => "Colorado", | |
"CT" => "Connecticut", | |
"DE" => "Delaware", |
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
var a = [20, 10, 5, 1]; | |
// Everyday array | |
a.sort(); | |
// [1, 10, 20, 5]... WTF? | |
a == [1, 10, 20, 5]; | |
// false | |
a === [1, 10, 20, 5]; |
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
import random | |
import sys | |
from time import sleep | |
print "*********Welcome to Joe's TicTacTAUNT game**********" | |
tictactoe = [ | |
0, 1, 2, | |
3, 4, 5, |
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 'fis/test' | |
class Dog | |
attr_accessor :name, :species, :colors, :fur_length | |
def initialize(attributes_hash) | |
attributes_hash.each do |key, value| | |
self.send("#{key}=", value) | |
end | |
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
# def math(range) | |
# x = 1..range.max | |
# #x*x = sum | |
# end | |
# sum.each do |x| | |
# x = 1..20 | |
# sum == 0 | |
# end | |
# 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
require 'rack' | |
class JoeApp #change this name | |
def call(env) | |
puts env['PATH_INFO'] | |
puts env['HTTP_ACCEPT'] | |
body = '<a href="http://students.flatironschool.com/students/joegiralt.html"><font color="pink"><h1>Hello Joe!</h1></font></a>' |
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
# From [Rubeque](http://rubeque.com/problems/reverse-each-word) | |
# Write a method that takes a sentence and returns it with each word reversed in place. | |
# ruby | |
# reverse_each_word.rb | |
# Write a method that takes a sentence and returns it with each word reversed in place. | |
# A String has many methods that can be called on it: | |
# http://www.ruby-doc.org/core-1.9.3/String.html |
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
# jukebox.rb | |
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 sqrt(y) | |
y = y ** 0.5 | |
return y | |
end | |
def is_prime(x) | |
return false if x <= 1 | |
2.upto(sqrt(x).to_i).any do |x| | |
return false if x %x == 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
##Objectives: | |
Use String, Hash, Array, and Enumerable methods to decode a string and discover a secret message | |
INSPIRATION: http://www.youtube.com/watch?v=Wj1d85CLDOQ | |
##Skills: | |
String.split, Array.each, Hash.each, Hash.sort_by, Range.to_a, Array.reverse, Array.push, Array.join, String.gsub, Array.index | |
##Instructions: | |
#Comments explain steps to manipulate string |