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
<nav class="navbar-nav navbar-default"> | |
<% if user_signed_in? %> | |
<li class="dropdown"> | |
<a href="#" class="dropdown-toggle" data-toggle="dropdown"> | |
<span class="glyphicon glyphicon-globe"></span> | |
</a> | |
<ul class="dropdown-menu" role="menu"> | |
<% if @messages.any? %> | |
<% @messages.each do |msg| %> | |
<li class="drop-links"> <%= link_to 'you received a message from ' + User.find(msg.sender_id).username, conversation_path(msg.conversation_id), remote: true %></li> |
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
def bakery_num(num_of_people, fav_food) | |
#Release 2 - Initializing the hash and the variables of the amount of food. | |
my_list = {"pie" => 8, "cake" => 6, "cookie" => 1} | |
pie_qty = 0 | |
cake_qty = 0 | |
cookie_qty = 0 | |
has_fave = false | |
# Release 3 |
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
##routes.rb | |
Rails.application.routes.draw do | |
resources :authentications | |
root to: "static_pages#home" | |
get 'static_pages/books' | |
devise_for :users, controllers: {omniauth_callbacks: "authentications", registrations: "registrations"} | |
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
## routes.rb | |
Rails.application.routes.draw do | |
devise_for :users, controllers: {registrations: 'registrations', omniauth_callbacks: 'omniauth_callbacks'} | |
root 'pages#home' | |
end | |
##config/initalizers/devise.rb | |
config.omniauth :facebook, 'your-app-key', "your-secret-key", :image_size => 'large' |
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
### requests/new.html.haml | |
= simple_form_for @request, remote: true do |f| | |
- if @request.errors.any? | |
#error_explanation | |
%h2= "#{pluralize(@request.errors.count, "error")} prohibited this request from being saved:" | |
%ul | |
- @request.errors.full_messages.each do |msg| | |
%li= msg |
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
= simple_form_for @charge, remote: true do |f| | |
= f.hidden_field :price, value: @request.recipient.price | |
= f.hidden_field :description, value: @request.recipient.name | |
= f.hidden_field :owner_id, value: @request.recipient.id | |
= f.hidden_field :vendor_id, value: params[:recipient_id] | |
= f.submit 'Send', id: 'charge-submit' | |
%script{src:"https://checkout.stripe.com/checkout.js", class:"stripe-button", data: {key: ENV["stripe_publishable_key"], price:"#{@request.recipient.price*100}", name:"ChessMentor", vendor_id: "#{@request.recipient.id}", description: "#{number_to_currency(@request.recipient.price)}", image: "/assets/landing_background.png"}} |
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 HttpRequest | |
attr_reader :method, :request_uri, :http_version | |
def initialize(website_string) | |
@method = website_string.split.first.upcase | |
@request_uri = website_string.split[1] | |
@http_version = website_string.split[2] | |
end | |
def to_hash | |
{method: @method, request_uri: @request_uri, http_version: @http_version} |
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"> | |
<h2 style="font-weight: 200;">You are playing the following deck: <b> <%= @game.deck.name %></b></h2> | |
<div class="score-holder" style="display: flex;"> | |
<p class="score-counter">Correct answers: <%= @game.right %></p> | |
<p class="score-counter">Incorrect answers: <%= @game.wrong %></p> | |
</div> | |
</div> | |
<hr /> | |
<div class="row"> |
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
##games/show.html.erb | |
<%= react_component("App", @data %> | |
## games_controller.rb | |
def show | |
@game = Game.current_game_by_id(params[:id]) | |
@user = User.find(session[:user_id]) | |
@card = @game.deck.cards[@game.card_idx] |
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
## assets/javascripts/components/App.jsx | |
var App = React.createClass({ | |
getInitialState: function() { | |
return { data: this.props, messages: [] }; | |
}, | |
handleNewAnswer: function(data) { | |
var newData = this.state.data; |
OlderNewer