This file contains hidden or 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 Tip | |
attr_reader :tip | |
def initialize(bill, tip) | |
@bill = bill | |
@tip = tip | |
end | |
def get_amount | |
@bill_amount = @bill.to_i | |
if @bill_amount == 0 |
This file contains hidden or 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
puts "How much does the bill come to?" | |
bill_amount = gets.chomp.to_i | |
while bill_amount == 0 | |
puts "Please enter a valid number for the bill amount:" | |
bill_amount = gets.chomp.to_i | |
end | |
while bill_amount < 0 | |
puts "Please enter a positive number:" | |
puts bill_amount = gets.chomp.to_i | |
end |
This file contains hidden or 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
Elasticsearch::Transport::Transport::Errors::BadRequest at /categories/defend-market-share | |
[400] {"error":"SearchPhaseExecutionException[Failed to execute phase [query], all shards failed; shardFailures {[oCuMYEy9Rs2FBhw6lBqTUA][contagiousfeed_development_feed_articles][0]: SearchParseException[[contagiousfeed_development_feed_articles][0]: from[0],size[10]: Parse Failure [Failed to parse source [{\"from\":0,\"size\":10,\"filter\":{\"and\":[{\"term\":{\"published\":true}},{\"terms\":{\"categories\":[\"defend-market-share\"]}}]},\"query\":{\"function_score\":{\"functions\":[{\"script_score\":{\"script\":\"(0.25/ ((3.16*pow(10,-11)) * abs(DateTime.now().getMillis() - doc['published_at'].date.getMillis()) + 0.05)) + _score\"}}],\"query\":{\"query_string\":{\"query\":\"Defend market share\",\"default_operator\":\"and\"}}}},\"sort\":[{\"published_at\":\"desc\"}],\"aggs\":{\"all_categories\":{\"filter\":{\"and\":[{\"term\":{\"published\":true}}]},\"aggs\":{\"categories\":{\"terms\":{\"field\":\"categories\",\"size\ |
This file contains hidden or 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
Elasticsearch::Transport::Transport::Errors::BadRequest at /categories/defend-market-share | |
[400] {"error":"SearchPhaseExecutionException[Failed to execute phase [query], all shards failed; shardFailures {[iPIrRP8XRjKSCa9MqWJSDw][contagiousfeed_development_feed_articles][0]: SearchParseException[[contagiousfeed_development_feed_articles][0]: from[0],size[10]: Parse Failure [Failed to parse source [{\"from\":0,\"size\":10,\"filter\":{\"and\":[{\"term\":{\"published\":true}},{\"terms\":{\"categories\":[\"defend-market-share\"]}}]},\"query\":{\"function_score\":{\"functions\":[{\"script_score\":{\"script\":\"(0.25/ ((3.16*pow(10,-11)) * abs(DateTime.now().getMillis() - doc['published_at'].date.getMillis()) + 0.05)) + _score\"}}],\"query\":{\"query_string\":{\"query\":\"Defend market share\",\"default_operator\":\"and\"}}}},\"sort\":[{\"published_at\":\"desc\"}],\"aggs\":{\"all_categories\":{\"filter\":{\"and\":[{\"term\":{\"published\":true}}]},\"aggs\":{\"categories\":{\"terms\":{\"field\":\"categories\",\"size\ |
This file contains hidden or 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="todo"> | |
<div class="panel panel-default"> | |
<div class="container"> | |
<div class="panel-body"> | |
<h2><%= @todo.id %>: <%= @todo.title %></h2> | |
<h4>More Info: <%= @todo.description %></h4> | |
<div class="row"> | |
<div class ="col-md-1"> | |
<a href="/todo" class="btn btn-default">Back</a> | |
<a href="/todo/<%= @todo.id %>/edit" class="btn btn-info">Edit</a> |
This file contains hidden or 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
require 'sinatra' | |
require 'data_mapper' | |
load 'datamapper_setup.rb' | |
class Todo | |
include DataMapper::Resource | |
property :id, Serial # An auto-increment integer key | |
property :title, String | |
property :description,String |
This file contains hidden or 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="todo"> | |
<div class="panel panel-default"> | |
<div class="container"> | |
<div class="panel-body"> | |
<h2><%= @todo.id %>: <%= @todo.title %></h2> | |
<h4>More Info: <%= @todo.description %></h4> | |
<div class="row"> | |
<div class ="col-md-1"> | |
<a href="/todo" class="btn btn-default">Back</a> | |
<a href="/todo/<%= @todo.id %>/edit" class="btn btn-info">Edit</a> |
This file contains hidden or 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
require 'sinatra' | |
require 'data_mapper' | |
load 'datamapper_setup.rb' | |
class Todo | |
include DataMapper::Resource | |
property :id, Serial # An auto-increment integer key | |
property :title, String | |
property :description,String |
This file contains hidden or 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.navbar.navbar-default | |
.container-fluid | |
.navbar-header | |
%span.navbar-brand | |
=link_to 'Users', admin_users_path | |
| | |
=link_to 'Invitations', admin_invitations_path | |
.collapse.navbar-collapse | |
.navbar-right | |
= link_to 'Log out', admin_session_path, method: 'delete', class: 'btn btn-sm btn-default navbar-btn' |
This file contains hidden or 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
describe '#redeem_by(user)' do | |
let(:access_contain_user_and_workshop_id) { Access.exists?(user_id: n, workshop_id: ["http-fundamentals", "rails-security"]) } | |
before do | |
@invitation = Factory.create(:invitation) | |
@user = Factory.create(:user) | |
@invitation.redeem_by(@user) | |
end |