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
require 'bundler/inline' | |
gemfile do | |
source 'https://rubygems.org' | |
gem 'csv' | |
gem 'graphql-client' | |
gem 'progressbar' | |
gem 'pry' | |
gem 'pry-byebug' | |
end | |
require 'graphql/client/http' |
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 applePayButtonClicked(event) | |
{ | |
var paymentRequest = { | |
// countryCode: The merchant’s ISO country code. | |
countryCode: 'US', | |
// currencyCode: The ISO currency code for the payment. | |
currencyCode: 'USD', | |
// total: The total amount for the payment. | |
total: { | |
label: 'Canine Clothing', |
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
begin | |
require 'bundler/inline' | |
rescue LoadError => e | |
$stderr.puts 'Bundler version 1.10 or later is required. Please update your Bundler' | |
raise e | |
end | |
gemfile(true) do | |
source 'https://rubygems.org' | |
gem 'activerecord', '4.2.0' |
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
#=Navigating= | |
visit('/projects') | |
visit(post_comments_path(post)) | |
#=Clicking links and buttons= | |
click_link('id-of-link') | |
click_link('Link Text') | |
click_button('Save') | |
click('Link Text') # Click either a link or a button | |
click_on('Button Value') |
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
module HstoreSetterGetter | |
# To use simply add to your models: | |
# | |
# include HstoreSetterGetter | |
# hstore_attributes :test1, :test2, type: :integer #assumes column_name: :data | |
# hstore_attributes :test3, :test4, column_name: :properties #assumes type: :string | |
# | |
# Written by Michael Elfassy | |
# http://napps.ca | |
# |
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
#!/usr/bin/env ruby | |
require "rubygems" # ruby1.9 doesn't "require" it though | |
require "thor" | |
class CloneRails < Thor | |
include Thor::Actions | |
desc "new NAME, TEMPLATE", "Create a new rails app based on a template app" | |
method_options :template => "template" | |
def new(name) | |
puts "Copying the template..." |
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
# Setup a template that can be cloned later | |
# Command: | |
# rails new NAME -m setup_template.rb | |
# (by default you should use "template" as NAME) | |
plugin("Rename", :git => "[email protected]:get/Rename.git") | |
# See http://everydayrails.com/2011/02/28/rails-3-application-templates.html if you need more customization of the template generator | |
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
#Orverwrite the image_tag based on the idea from Designer Wall (http://webdesignerwall.com/tutorials/css3-image-styles) | |
def image_tag(source, options = {}) | |
image_width = image_height = nil | |
image_width_css = image_height_css = "" | |
options.symbolize_keys! | |
options[:class] = "image-wrap " + options[:class] |