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
Full version: | |
$(document).ready(function)(){ | |
// do something on document ready | |
}; // end of ready function | |
shorthand version: | |
$(function(){ | |
// do something on document ready |
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
group :test, :development do | |
gem 'rspec-rails' | |
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
<h2>Contacts</h2> | |
<table> | |
<thead> | |
<tr> | |
<th>ID</th> | |
<th>First Name</th> | |
<th>Last Name</th> | |
<th>Phone</th> | |
<th>Email</th> |
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
<div class="container"> | |
<h1>User Skills and Levels</h1> | |
<%# TODO: display the skills and proficiency levels for each user ... %> | |
<table> | |
<thead> | |
<tr> | |
<th>Name</th> | |
<th>Skill</th> |
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
function Animal(name, legs){ | |
this.name = name; | |
this.legs = legs; | |
}; | |
var Zoo = { | |
init: function(arg){ | |
var animals = arg; | |
}, // init |
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
$(document).ready(function(){ | |
$('#get_color').click(function(event){ | |
event.preventDefault(); | |
$.post('/color', function(response){ | |
$("#color_me li:nth-child(" + response.cell +")").css( "background-color", response.color ); | |
}, 'json'); | |
}); | |
}); | |
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 { | |
font-family: "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif; | |
} | |
body { | |
margin: 0; | |
padding: 0; | |
} | |
header { |
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 OrangeTree < AR::Base | |
has_many :oranges | |
has_many :seeds, through: :oranges, source: :seedlings | |
end | |
class Orange < AR::Base | |
belongs_to :orange_tree | |
has_many :seedlings, class_name: "Seed" | |
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
<%= display_errors(@user) %> | |
<% unless @user.errors.eppty? %> | |
<div class="errors"> | |
<% @user.errors.full_messages.each do |message| %> | |
<p><%= message %></p> | |
<% end %> | |
</div> | |
<% 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
get '/' do | |
# Look in app/views/index.erb | |
erb :index | |
end | |
get '/signin' do | |
user = User.authenticate(params[:email], params[:password]) | |
if user | |
session[:user_id] = user.id |