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
// handle window.console if console.log isn't available. Define an empty function here | |
function emptyFunction() { } | |
if (window.console === undefined) { | |
window.console = { | |
log: emptyFunction, | |
error: emptyFunction, | |
info: emptyFunction, | |
trace: emptyFunction | |
}; | |
} |
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 ApplicationController < ActionController::Base | |
#... | |
unless Rails.application.config.consider_all_requests_local | |
rescue_from Exception, with: lambda { |exception| render_error 500, exception } | |
rescue_from ActionController::RoutingError, ActionController::UnknownController, ::AbstractController::ActionNotFound, ActiveRecord::RecordNotFound, with: lambda { |exception| render_error 404, exception } | |
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
require 'spec_helper' | |
feature "My Feature: " do | |
context "User Registers" do | |
scenario "through api" do | |
VCR.use_cassette "register_new_user", :record => :new_episodes do | |
#make api call | |
end | |
end | |
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
PUT http://<spree-domain>/api/checkouts/<order_number>?order[payments_attributes][][payment_method_id]=<braintree_payment_id_spree>&order[payments_attributes][][amount]=<amount>&order[payments_attributes][][source_attributes][gateway_payment_profile_id]=<braintree_customer_id>&order[payments_attributes][][source_attributes][gateway_customer_profile_id]=<braintree_payment_id>&order[payments_attributes][][source_attributes][year]=<year>&order[payments_attributes][][source_attributes][month]=<month> |
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
#... | |
match 'sitemap.xml' => 'sitemap#sitemap' | |
#... |
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
<style> | |
.video-container { | |
position: relative; | |
padding-bottom: 50%; | |
padding-top: 30px; height: 0; overflow: hidden; | |
} | |
.video-container iframe, | |
.video-container object, | |
.video-container embed { |
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
ActiveAdmin.register Post do | |
index do | |
selectable_column | |
column :name do |post| | |
link_to post.name, admin_post_path(post) | |
end | |
column :author | |
#... | |
end | |
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
# Capybara | |
=Navigating= | |
visit('/projects') | |
visit(post_comments_path(post)) | |
=Clicking links and buttons= | |
click_link('id-of-link') | |
click_link('Link Text') | |
click_button('Save') |
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
def is_number?(str) | |
true if Float(str) rescue false | |
end | |
def prettify(str) | |
str = str.to_f | |
str.to_i == str ? str.to_i : str | |
end |
OlderNewer