Installation
gem install rmagick # you'll need ImageMagick & Ruby first
gem install colormath
gem install micro-optparse
Rails.application.assets.logger = Logger.new('/dev/null') | |
Rails::Rack::Logger.class_eval do | |
def call_with_quiet_assets(env) | |
previous_level = Rails.logger.level | |
Rails.logger.level = Logger::ERROR if env['PATH_INFO'].index("/assets/") == 0 | |
call_without_quiet_assets(env).tap do | |
Rails.logger.level = previous_level | |
end | |
end | |
alias_method_chain :call, :quiet_assets |
awk 'BEGIN { system("mkdir -p splitted/sub"++j) } | |
/<doc/{x="F"++i".xml";}{ | |
if (i%5==0 ){ | |
++i; | |
close("splitted/sub"j"/"x); | |
system("mkdir -p splitted/sub"++j"/"); | |
} | |
else{ | |
print > ("splitted/sub"j"/"x); |
# GIT REMOVE FILE FROM ALL BRANCHES | |
git filter-branch --force --index-filter \ | |
'git rm --cached --ignore-unmatch contents.sql' \ | |
--prune-empty --tag-name-filter cat -- --all | |
# GIT REMOTE BRANCH FETCH AND CREATE | |
git checkout --track origin/daves_branch |
#Migrate back but a specific verison only | |
rake db:migrate:down VERSION=20150406100828 |
[6/18/15, 2:44:59 PM] Kapil Nakhwa: s3 = AWS::S3.new | |
bucket = s3.buckets.create('dns-compat-bucket-name') | |
[6/18/15, 2:45:33 PM] Kapil Nakhwa: s3 = AWS::S3.new( | |
:access_key_id => 'YOUR_ACCESS_KEY_ID', | |
:secret_access_key => 'YOUR_SECRET_ACCESS_KEY') | |
bucket = s3.buckets['my-bucket'] # no request made | |
Originally published in June 2008
When hiring Ruby on Rails programmers, knowing the right questions to ask during an interview was a real challenge for me at first. In 30 minutes or less, it's difficult to get a solid read on a candidate's skill set without looking at code they've previously written. And in the corporate/enterprise world, I often don't have access to their previous work.
To ensure we hired competent ruby developers at my last job, I created a list of 15 ruby questions -- a ruby measuring stick if you will -- to select the cream of the crop that walked through our doors.
Candidates will typically give you a range of responses based on their experience and personality. So it's up to you to decide the correctness of their answer.
# This is a skeleton for testing models including examples of validations, callbacks, | |
# scopes, instance & class methods, associations, and more. | |
# Pick and choose what you want, as all models don't NEED to be tested at this depth. | |
# | |
# I'm always eager to hear new tips & suggestions as I'm still new to testing, | |
# so if you have any, please share! | |
# | |
# @kyletcarlson | |
# | |
# This skeleton also assumes you're using the following gems: |
Remove merged branch | |
git branch --merged | grep -v "\*" | grep -v master | grep -v dev | xargs -n 1 git branch -d | |
Git log of code snippet | |
git log -S'the line from your file' -- path/to/your/file.txt |