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
#!/usr/bin/env sh | |
# Download lists, unpack and filter, write to stdout | |
curl -s https://www.iblocklist.com/lists.php \ | |
| sed -n "s/.*value='\(http:.*=bt_.*\)'.*/\1/p" \ | |
| xargs wget -O - \ | |
| gunzip \ | |
| egrep -v '^#' |
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
ERROR: Error installing pg: | |
ERROR: Failed to build gem native extension. | |
... | |
Can't find the 'libpq-fe.h header | |
... |
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
$ gem install pg -- --with-pg-config=/Applications/Postgres.app/Contents/Versions/9.5/bin/pg_config |
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
v1 = '0.3.2' | |
v2 = '0.10.1' | |
a1 = v1.split('.').map{|v| v.to_i} | |
a2 = v2.split('.').map{|v| v.to_i} | |
(a1 <=> a2) < 0 # v1 < v2 | |
=> true | |
(a1 <=> a2) > 0 # v1 > v2 | |
=> false |
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
v1 = '0.3.0' | |
v2 = '0.3' | |
a1 = v1.split('.').map{|v| v.to_i} | |
a2 = v2.split('.').map{|v| v.to_i} | |
(a1 <=> a2) == 0 # v1 == v2 | |
=> false | |
(a1 <=> a2) > 0 # v1 > v2 | |
=> true |
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
Gem::Version.new('0.3.2') < Gem::Version.new('0.10.1') | |
=> true | |
Gem::Version.new('0.3.0') == Gem::Version.new('0.3') | |
=> true |
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
Rails.application.configure do | |
# Settings specified here will take precedence over those in config/application.rb. | |
... | |
# Raise exceptions instead of rendering exception templates. | |
config.action_dispatch.show_exceptions = true | |
... | |
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 'rails_helper' | |
RSpec.describe 'My API' do | |
let(:request) do | |
lambda do | |
get '/my_api/value-cannot-be-routed-due-to-route-constraints' | |
end | |
end | |
context 'when action_dispatch.show_exceptions is false (default behavior on test env)' do |
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
# frozen_string_literal: true | |
module ErrorResponses | |
def rails_respond_without_detailed_exceptions | |
env_config = Rails.application.env_config | |
original_show_exceptions = env_config['action_dispatch.show_exceptions'] | |
original_show_detailed_exceptions = env_config['action_dispatch.show_detailed_exceptions'] | |
env_config['action_dispatch.show_exceptions'] = true | |
env_config['action_dispatch.show_detailed_exceptions'] = false | |
yield | |
ensure |