All code is available in example app - https://github.com/maxivak/webpacker-rails-example-app
Expect some false positives here, but hopefully most of these are open source Rails apps that use (or once used) AngularJS.
If you'd like to help update the list, please comment below with any of these apps you discover do not use AngularJS and include my username (@eliotsykes) in your message.
This page lists the options for breaking single-line expressions into multiple lines in Ruby.
Developers and teams need to come to their own decisions about which guideline(s) they prefer (preferences below are just my personal choices and I encourage you to disregard them).
# With trailing parens
x = [1, 2, 3].join(
'-'
Rails.application.configure do | |
# ... | |
require_relative '../../spec/support/no_animations' | |
config.middleware.use Rack::NoAnimations | |
end |
Stripe.applePay.checkAvailability = function (callback) { | |
if (location.protocol === 'https:') { | |
var canMakePayments = window.ApplePaySession && ApplePaySession.canMakePayments() | |
if (/^pk_test_/.test(Stripe.key || Stripe.publishableKey)) { | |
callback(canMakePayments) | |
} else if (canMakePayments) { | |
var merchantId = "merchant." + window.location.hostname + ".stripe" | |
ApplePaySession.canMakePaymentsWithActiveCard(merchantId).then(callback) | |
} else { |
// Requires jQuery | |
var logger = { | |
setup: function() { | |
$('<div style="position:fixed; top: 0; left: 0; width: 100%; background-color: white;"><pre id="log-output" style="max-height: 70px; font-size: 10px; line-height: 12px;"></pre></div>') | |
.appendTo('body'); | |
this.logOutput = $('#log-output'); | |
}, | |
info: function(msg) { this.logOutput.prepend(msg + "\n"); }, | |
hide: function() { this.logOutput.parent().hide(); }, | |
show: function() { this.logOutput.parent().show(); } |
# File: app/controllers/api/api_controller.rb | |
class Api::ApiController < ActionController::Base | |
# Consider subclassing ActionController::API instead of Base, see | |
# http://api.rubyonrails.org/classes/ActionController/API.html | |
protect_from_forgery with: :null_session | |
before_action :authenticate | |
def self.disable_turbolinks_cookies | |
skip_before_action :set_request_method_cookie |
At time of writing, Cloud9 has PostgreSQL pre-installed, so you won't need to install it yourself. However, its not running by default, so you will need to start it with this command in the terminal:
sudo service postgresql start
Change the PostgreSQL password to 'password' (or choose a different password):
#!/bin/sh | |
# Create this file in the bin/ directory of your | |
# Rails app. | |
# Run this script to deploy the app to Heroku. | |
set -e | |
# Push changes to Heroku |
# Copy NaiveHash (end of this file) and rename to RubyHash. | |
# | |
# Try using RubyHash in irb/pry and store some data in it | |
# and notice it has problems with remembering all of your data due | |
# to RubyHash not handling hash collisions: | |
# | |
# require_relative 'ruby_hash' | |
# h = RubyHash.new | |
# ('a'..'z').each do |char| | |
# h[char] = char.upcase |