Skip to content

Instantly share code, notes, and snippets.

@BGuimberteau
BGuimberteau / pre-commit
Created Jul 25, 2015
hook for pre-commit and not commit if found some strings
View pre-commit
#!/usr/bin/env ruby
exit 0 if ARGV.include?('--no-verify')
keywords = %w(\.pry console.log)
files_changed = %x(git diff-index --name-only HEAD --).split
%x(git grep -q -E "#{keywords.join('|')}" #{files_changed.join(' ')})
if $?.exitstatus.zero?
@BGuimberteau
BGuimberteau / strong_params_helpers.rb
Last active May 18, 2018
Strong parameters with grape
View strong_params_helpers.rb
module StrongParamsHelpers
extend Grape::API::Helpers
def permitted_params
@permitted_params ||= declared(params, include_missing: false, include_parent_namespaces: false)
end
end
@BGuimberteau
BGuimberteau / Terminal
Last active Dec 22, 2015
RVM basic usage
View Terminal
Install RVM
$ \curl -L https://get.rvm.io | bash -s stable
Install latest version of ruby version 2.0.0 (today: ruby-2.0.0-p247
$ rvm install 2.0.0
Go in your application folder & create file for RVM (specific ruby version and Gemset: .ruby-gemset & .ruby-version)