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
Name: Janel diBiccari | |
Github: https://github.com/jdibiccari | |
Blog: http://syntacticsugarhouse.tumblr.com/ | |
Tagline: Struggling toward conscious incompetence! | |
Profile Picture: http://i59.tinypic.com/osfy39.jpg | |
Treehouse Account: http://teamtreehouse.com/janeldibiccari | |
CoderWall Account: https://coderwall.com/jdibiccari | |
CodeSchool Account: https://www.codeschool.com/users/jdibiccari | |
Favorite Websites: |
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
name = "Katherine" | |
major = "Psychology and Gender Studies" | |
school = "Wesleyan" | |
college_major = "%s majored in %s at %s." % [name, major, school] | |
# => Katherine majored in Psychology and Gender Studies at Wesleyan. |
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
new_string = %*I don't have to worry about "quotation marks" anymore!* | |
puts new_string | |
#=> I don't have to worry about "quotation marks" anymore! |
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
my_poem = <<DOC | |
Oh Ruby | |
I would write poems | |
About you | |
If I could | |
DOC |
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
#Jones Rule of 86 | |
#Where sugar_content is a percentage | |
def jones_rule_of_86 (sugar_content) | |
gallons_sap_to_gallon_syrup = 86 / sugar_content | |
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
Submarine = Struct.new(:captain, :sub_name) | |
scimitar = Submarine.new("Janel", "Scimitar") | |
#=> <struct Submarine captain="Janel", sub_name="Scimitar> |
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
Submarine = Struct.new(:captain, :sub_name) do | |
def destination? | |
puts "Headed to the Aquadome" | |
end | |
end | |
scimitar2 = Submarine.new("Lauren", "Scimitar 2") | |
scimitar2.captain | |
#=> Lauren | |
scimitar2.destination? |
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
var shift = -5 % 4 | |
//=> shift = -1 |
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
Number.prototype.negMod = function(n) { | |
return ((this%n)+n)%n; | |
}; | |
//Where 'this' is the number we are taking modulus of |
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
<!-- Example of an each loop --> | |
<ul> | |
<%Artist.list_alphabetically.each do |artist|%> | |
<li><a href="artists/<%=artist.url%>"><%=artist.name%></a> song count: <%=artist.songs_count%></li> | |
<%end%> | |
</ul> | |
<!-- Example of an if statement --> | |
<h4><%=artist.name%> - <%=artist.songs_count%> | |
<%if artist.songs_count > 1%> |
OlderNewer