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 Person | |
attr_accessor :name | |
attr_accessor :hometown | |
def bio | |
# Add code here | |
end | |
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
#RECURSION EXERCISES | |
# BASIC RECURSION FACTORIAL FUNCTION | |
def factorial(n) | |
#termination case | |
if n < 0 | |
return puts "You can't factorial a negative number!" | |
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
#FIZZ BUZZ | |
#Counts up from 1 to 100 | |
#puts 'fizz' if the number is divisible by 3 | |
#puts 'buzz' if the number is divisible by 5 | |
#puts 'fizzbuzz' if the number is divisible by 3 and 5 | |
(1..100).each do |number| | |
if (number % 3 == 0) && (number % 5 == 0) |
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
<html> | |
<head> | |
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script> | |
<script src="http://www.zurb.com/playground/javascripts/plugins/jquery.annotate.js"></script> | |
<style type="text/css"> | |
.black { | |
background: black; | |
height: 5px; | |
width: 5px; |
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
<%= form_for [@user, @project] do |f| %> | |
<% if @project.errors.any? %> | |
<div id="error_explanation"> | |
<h2><%= pluralize(@project.errors.count, "error") %> prohibited this project from being saved:</h2> | |
<ul> | |
<% @project.errors.full_messages.each do |msg| %> | |
<li><%= msg %></li> | |
<% end %> | |
</ul> |
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
The stack: | |
OS | |
Web server | |
application server | |
database server | |
more.... (caching, any tools to keep an up and running) | |
A fresh rails development stack: | |
Mac OSX - WEBrick - SQLite |
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
.two-column { | |
-moz-column-count: 2; /* Firefox */ | |
-webkit-column-count: 2; /* Safari and Chrome */ | |
column-count: 2; | |
-moz-column-gap:40px; /* Firefox */ | |
-webkit-column-gap:40px; /* Safari and Chrome */ | |
column-gap:40px; | |
} |
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
# Where I ended up... | |
class Phrase < String | |
def word_count | |
words.each_with_object(Hash.new(0)) { |word, word_count| word_count[word] += 1 } | |
end | |
def words | |
downcase.scan(/\w+/) |
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
# Where I ended up... | |
class DNA < String | |
def to_rna | |
tr('T','U') | |
end | |
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
# Where I ended up... | |
class Bob | |
def hey input | |
talking = Phrase.new(input) | |
return 'Fine. Be that way.' if talking.silent? | |
return 'Woah, chill out!' if talking.yelling? |
OlderNewer