This file contains 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
<!-- # views/students/students.erb --> | |
<!-- Begin Title Content --> | |
<div class="page-title"> | |
<h2>Every Story Has Villains</h2> | |
<h3>We're <%= @students.size %> people on a journey to learn to smell code.</h3> | |
</div> | |
<!-- End Title Content --> |
This file contains 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.each do |key, value| | |
hash.delete(key) if value.nil? | |
end |
This file contains 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
big_array = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20] | |
big_array.inject(:lcm) |
This file contains 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 MyApp | |
def call(env) | |
puts "hello from MyApp" | |
[200, {}, ["Hello"]] | |
end | |
end | |
class ContentType | |
def initialize(app) | |
@app = app |
This file contains 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 StevenApp | |
def call(env) | |
p env['PATH_INFO'] | |
p env['HTTP_ACCEPT'] | |
[200, {'Content-Type' => 'text/html'}, | |
['<h1>Hello <a style="color: pink" href="http://students.flatironschool.com/students/stevenbrooks.html">Steven</a></h1>']] |
This file contains 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 reverse_each_word(sentence) | |
sentence.split.collect { |word| word.reverse }.join(" ") | |
end | |
puts reverse_each_word("Hello world") |
This file contains 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
# Testing / Assertion | |
# Define a method that takes two values and compares them, printing pass or fail | |
class Person | |
attr_accessor :name, :birthday :age | |
def name(string) | |
@name = string | |
end |
This file contains 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
# Columns to add to Students table: | |
# Name | |
# Profile Pic | |
# Social media links/ Twitter, LinkedIn, GitHub, Blog(RSS) | |
# Quote | |
# About/ Bio, Education, Work | |
# Coder Cred / Treehouse, Codeschool, Coderwal .reject(Github) | |
require 'nokogiri' | |
require 'open-uri' |
This file contains 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
ITEMS = [ {"AVOCADO" => {:price => 3.00, :clearance => true}}, | |
{"KALE" => {:price => 3.00,:clearance => false}}, | |
{"BLACK_BEANS" => {:price => 2.50,:clearance => false}}, | |
{"ALMONDS" => {:price => 9.00, :clearance => false}}, | |
{"TEMPEH" => {:price => 3.00,:clearance => true}}, | |
{"CHEESE" => {:price => 6.50,:clearance => false}}, | |
{"BEER" => {:price => 13.00, :clearance => false}}, | |
{"PEANUTBUTTER" => {:price => 3.00,:clearance => true}}, | |
{"BEETS" => {:price => 2.50,:clearance => false}} | |
] |
This file contains 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
$basketball_game = | |
{ | |
:team_1 => | |
{ | |
:team_name => "Nets", | |
:color => ["black", "grey"], | |
:player_1 => | |
{ | |
:name => "Brooke Lopez", | |
:jersey => 11, |