Skip to content

Instantly share code, notes, and snippets.

View jdibiccari's full-sized avatar

Janel diBiccari jdibiccari

View GitHub Profile
@jdibiccari
jdibiccari / basic_info
Created April 30, 2014 21:08
Internet presence/basic info
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:
@jdibiccari
jdibiccari / string_demo.rb
Last active August 29, 2015 14:01
blog_post_1
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.
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!
@jdibiccari
jdibiccari / heredoc.rb
Created May 7, 2014 03:20
blog_post_1
my_poem = <<DOC
Oh Ruby
I would write poems
About you
If I could
DOC
@jdibiccari
jdibiccari / Jones_rule_of_86.rb
Last active August 29, 2015 14:01
blog_post_2
#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
@jdibiccari
jdibiccari / structs.rb
Last active August 29, 2015 14:01
blog_post_3
Submarine = Struct.new(:captain, :sub_name)
scimitar = Submarine.new("Janel", "Scimitar")
#=> <struct Submarine captain="Janel", sub_name="Scimitar>
@jdibiccari
jdibiccari / structs_2.rb
Last active August 29, 2015 14:01
blog_post_3
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?
@jdibiccari
jdibiccari / mod.js
Created May 27, 2014 13:16
blog_post_4
var shift = -5 % 4
//=> shift = -1
@jdibiccari
jdibiccari / mod_2.js
Created May 27, 2014 13:22
blog_post_4
Number.prototype.negMod = function(n) {
return ((this%n)+n)%n;
};
//Where 'this' is the number we are taking modulus of
<!-- 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%>