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(@destination) do |destination_builder| %> | |
<%= render 'shared/error_messages' %> | |
<p> | |
<%= destination_builder.label :title %> | |
<%= destination_builder.text_field :title, class: 'form-control' %><br> | |
</p> | |
<p> | |
<%= destination_builder.label :location %> | |
<%= destination_builder.text_field :location, class: 'form-control' %><br> |
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"> | |
<div class=" well col-sm-6"> | |
<%= render 'shared/error_messages' %> | |
<h3>Food Travel Story</h3> | |
<p>Title: <%=@destination.title%></p> | |
<p>Written by: <%= @destination.user.name %></p> | |
<p>Location: <%=@destination.location%></p> | |
<p>Name: <%=@food.name%></p> | |
<p>Type of Food: <%=@food.category%></p> |
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 DestinationsController < ApplicationController | |
def index | |
@destinations = Destination.all | |
end | |
def show | |
@destination = Destination.find(params[:id]) | |
@food = @destination.food | |
if current_user | |
@comment = current_user.comments.build(destination: @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
class ApplicationController < ActionController::Base | |
protect_from_forgery with: :exception | |
before_action :configure_permitted_parameters, if: :devise_controller? | |
def after_sign_in_path_for(resource) | |
request.env['omniauth.origin'] || root_path | |
end | |
protected |
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 CommentsController < ApplicationController | |
before_action :set_destination | |
def create | |
@comment = current_user.comments.create(comment_params) | |
@comment.destination = @destination | |
@comment.save | |
redirect_to destination_path(@destination) | |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Bouncing Ball</title> | |
</head> | |
<body> | |
<div class="ball"></div> | |
<div class="shadow"></div> | |
</body> | |
</html> |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Bounce In</title> | |
</head> | |
<body> | |
<div><h1>Bounce In</h1></div> | |
<p>Example from <a href="https://robots.thoughtbot.com/css-animation-for-beginners">CSS Animation for Beginners by Rachel Cope</a>, December 04, 2014</p> | |
</body> | |
</html> |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>CSS Animations</title> | |
</head> | |
<body> | |
<div class="small-square"></div> | |
<div class="square"></div> | |
<div class="balloon"><img src="http://www.pngpix.com/wp-content/uploads/2016/08/PNGPIX-COM-Hot-Air-Balloon-PNG-Transparent-Image.png"></div> | |
</body> |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Heart</title> | |
</head> | |
<body> | |
<div class='container'> | |
<div class='heart'></div> | |
</div> | |
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
// Split the array into halves and merge them recursively | |
function mergeSort(array) { | |
if (array.length === 1) { | |
// Return once we hit an array with a single item | |
return array | |
} | |
// Get the middle item of the array rounded down by creating a variable | |
const middle = Math.floor(array.length / 2) | |
// Create a variable for the items on the left side |
OlderNewer