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
highlight -O rtf -t 2 -K 40 -k 'Source Code Pro' --style edit-vim app/controllers/pokemons_controller.rb | pbcopy |
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
AllCops: | |
Exclude: | |
- 'db/**/*' | |
TargetRubyVersion: 2.3 | |
Rails: | |
Enabled: true | |
########################## Lint ################################ |
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
#Model | |
@user.should have(1).error_on(:username) # Checks whether there is an error in username | |
@user.errors[:username].should include("can't be blank") # check for the error message | |
#Rendering | |
response.should render_template(:index) | |
#Redirecting | |
response.should redirect_to(movies_path) |
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
test: | |
pre: | |
- "[[ ! -s \"$(git rev-parse --git-dir)/shallow\" ]] || git fetch --unshallow" | |
post: | |
- bundle exec pronto run -f github -c=$(git log --pretty=format:%H | tail -1) |
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 ruby | |
require 'fileutils' | |
files = Dir["*/*.PDF"].collect{|f| File.expand_path(f)} | |
files.each_with_index do |file, index| | |
puts "copying file #{index}" | |
FileUtils.cp file, "pdf/#{index}.pdf" | |
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
## Remove common characters from phone numbers. | |
value.replace("-","").replace(".","").replace("-","").replace("(","").replace(")","").replace(" ","") | |
## Takes phone numbers formatted as 5555555555 and formats them as 555-555-5555 | |
value.slice(0,3) + "-" + value.slice(3,6) + "-" + value.slice(6,10) | |
## add zeros to the front of zip codes. Useful for when Excel removes them. | |
"000000"[0,10-value.length()] + value |