Category - Ruby on Rails

Running rubocop on a local git branches’ diff

You can run rubocop on just a local branches’ changes like this: git fetch && git diff-tree -r –no-commit-id –name-only master@\{u\} head | xargs ls -1 2>/dev/null | xargs rubocop –force-exclusion Then you can create 2 corresponding aliases in your terminal .rc file to make this easy to remember: # Alias to run rubocop on the current branch’s diff from […]


Updating Rails-API to Rails 5 in API mode

Since rails-api was merged into Rails as part of Rails 5, the rails-api project has largely been abandoned, and for good reason. People who have a rails-api app will want to update to Rails 5 in order to stay up-to-date. Although the process is not hard, it is slightly different from a traditional update from Rails 4 to Rails 5. […]


TomDoc for JavaScript?

I love code documentation. Here are some reasons: 1. It reduces cognitive load when maintaining legacy code (helps you figure out which button to press faster). Docs communicate how the code should be working at a specific point in time, and this can┬áreduce debugging time when tracking down a bug. 2. It communicates intent. This helps future developers to respect […]