Skip to content

Instantly share code, notes, and snippets.

@tsyber1an
Last active September 14, 2015 10:16
Show Gist options
  • Save tsyber1an/0ab6b952b9d9e0244442 to your computer and use it in GitHub Desktop.
Save tsyber1an/0ab6b952b9d9e0244442 to your computer and use it in GitHub Desktop.
Development cheat sheet

GIT

Ruby's syntax check for changed files.

git diff --name-only | xargs -IN ruby -c N

Run tests for changed test files

git diff --name-only | grep "test/" | grep -vE "support|helper" | xargs -IN bundle exec ruby -Itest N

git show files changed in branch

git diff --name-status master..branchName

git revert single file

git checkout -- file

new branch from commit

git checkout -b <branch-name> <commit-hash>

Undo revert

git revert object
git reset --hard HEAD^

Guard

Special runner

bin/guard start -c -P Rspec Livereload Bundler

Ctags

for Rails

/usr/local/bin/ctags -R --exclude=.git --exclude=log --exclude=app/assets --exclude=vendor

Ruby

perf

https://github.com/JuanitoFatas/fast-ruby

Bash

while working in old and new rails projects i noticed annoying to type by thinking so then

function c {
  ruby script/console production || bin/rails c staging
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment