Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am ryanspittler on github.
  • I am bucketmouse (https://keybase.io/bucketmouse) on keybase.
  • I have a public key ASDCRjtN46FTGgO54JtrvnoStcTH5NVLl2EKJ4W76JWJhQo

To claim this, I am signing this object:

@RyanSpittler
RyanSpittler / ApplicationController.rb
Last active August 29, 2015 14:24
Displaying the routing path with parameter names
before_action :display_route_path
def display_route_path
matchdata = Rails.application.routes.router.recognize(request) {}.first.first
parameters = matchdata.names
matches = matchdata.instance_variable_get(:@match).to_a
@url = matches.shift
matches.compact.each_with_index do |mtch, index|
@url.sub!(/#{mtch}/, ":#{parameters[index]}")
end
@RyanSpittler
RyanSpittler / production.rb
Created June 2, 2015 19:22
Production.rb
# Do not fallback to assets pipeline if a precompiled asset is missed.
# But for Heroku, we need to get those assets, namely glyphicons.
config.serve_static_assets = true
config.assets.compile = true
@RyanSpittler
RyanSpittler / production.rb
Created June 2, 2015 19:12
Production file for broken Glyphicons
# Do not fallback to assets pipeline if a precompiled asset is missed.
config.assets.compile = false
@RyanSpittler
RyanSpittler / omniauth_spec.rb
Created April 30, 2015 03:28
OmniAuth Shared Examples
require 'rails_helper'
shared_examples 'it is OmniAuth Compatible' do |provider|
before(:each) do
generate_sample
OmniAuth.config.test_mode = true
OmniAuth.config.mock_auth[provider] = {
provider: "#{provider}",
uid: '250523709',
info: {
@RyanSpittler
RyanSpittler / omniauth_spec.rb
Created April 15, 2015 23:01
Rspec with OmniAuth Solution
require 'rails_helper'
OmniAuth.config.test_mode = true
OmniAuth.config.mock_auth[:github] = {
provider: 'github',
info: {
name: 'first last',
email: 'email@email.com'
}
}
@RyanSpittler
RyanSpittler / omniauth_spec.rb
Created April 15, 2015 22:31
OmniAuth Additions
OmniAuth.config.test_mode = true
OmniAuth.config.mock_auth[:github] = {
provider: 'github',
info: {
name: 'first last',
email: 'email@email.com'
}
}
@RyanSpittler
RyanSpittler / omniauth_spec.rb
Last active August 29, 2015 14:19
First Rspec Trial for OmniAuth
require 'rails_helper'
feature 'OmniAuth Signup' do
scenario 'can sign up via Github' do
visit '/'
click_link 'Signup'
click_button 'Sign up via GitHub'
expect(page).to have_content('Verify Details')
@RyanSpittler
RyanSpittler / ruby.rb
Created March 9, 2015 23:20
If Then Else
1 + 2 == 3 ? "Yes, I did! ',=)" : "No, I didn't. =("
@RyanSpittler
RyanSpittler / ruby.rb
Created March 9, 2015 23:18
If Then Else
if 1 + 2 == 3
"Yes, I did! ',=)"
else
"No, I didn't. =("
end