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
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
# 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 '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
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
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
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
#!/bin/bash | |
# Pull this file down, make it executable and run it with sudo | |
# wget https://raw.github.com/gist/5487621/build-erlang-r16b.sh | |
# chmod u+x build-erlang-r16b.sh | |
# sudo ./build-erlang-r16b.sh | |
if [ $(id -u) != "0" ]; then | |
echo "You must be the superuser to run this script" >&2 | |
exit 1 | |
fi |
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
hash = {} | |
perfect_sqrs = [] | |
(1..300).each do |num| | |
perfect_sqrs << (num**2) | |
end | |
find_partition = lambda do |elts| | |
p "ELTS: #{elts}" | |
if elts.empty? | |
[[]] |
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
class Integer | |
def choose(k) | |
return 0 if (k > self) | |
n = self | |
r = 1 | |
1.upto(k) do |d| | |
r *= n | |
r /= d | |
n -= 1 | |
end |