Skip to content

Instantly share code, notes, and snippets.

<!-- # 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 -->
hash.each do |key, value|
hash.delete(key) if value.nil?
end
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)
class MyApp
def call(env)
puts "hello from MyApp"
[200, {}, ["Hello"]]
end
end
class ContentType
def initialize(app)
@app = app
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>']]
def reverse_each_word(sentence)
sentence.split.collect { |word| word.reverse }.join(" ")
end
puts reverse_each_word("Hello world")
# 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
# 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'
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}}
]
@stevenabrooks
stevenabrooks / basketball
Created June 11, 2013 12:43
actually really impressed how i was able to do this pretty well
$basketball_game =
{
:team_1 =>
{
:team_name => "Nets",
:color => ["black", "grey"],
:player_1 =>
{
:name => "Brooke Lopez",
:jersey => 11,