Skip to content

Instantly share code, notes, and snippets.

@BGuimberteau
BGuimberteau / pre-commit
Created July 25, 2015 09:20
hook for pre-commit and not commit if found some strings
#!/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 / Terminal
Last active December 22, 2015 19:49
RVM basic usage
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)
@BGuimberteau
BGuimberteau / strong_params_helpers.rb
Last active May 18, 2018 08:25
Strong parameters with grape
module StrongParamsHelpers
extend Grape::API::Helpers
def permitted_params
@permitted_params ||= declared(params, include_missing: false, include_parent_namespaces: false)
end
end