Showing posts with label git. Show all posts
Showing posts with label git. Show all posts

Saturday, August 2, 2014

How to Change Tab Size in Vim and Other Nifty *Nix Tricks

I learned two nifty *nix tricks this week that I'd like to save here both so I can find them again if I manage to lose my notes (or my muscle memory) and in the hopes that I can save another future dev a little bit of time.

To change your tab size in Vim, first at the command line, type:

vim $HOME/.vimrc

This will open the user preferences file for Vim, creating it if the files doesn't already exist. You will then be popped into your Vim editor, where you can enter your preferences. Remember to type the letter a to enter insert mode. Otherwise, anything you type will be interpreted as a Vim command. Ready?

Here's where you can paste all those nifty "yak-shaving" "time-saving" snippets you've been finding online! I used

set tabstop=4
set shiftwidth=4
set expandtab

Press the esc key to re-enter command mode then :wq to save and exit. Re-open Vim and voila! You've just set your tabs to 4 spaces!


My second trick is much shorter, but it's a great little command just the same. When working in Git, before you add any files using git add type

git diff

to see the changes you've made across all of the files in your working repository. If you've already started tracking the files using git add, type

git diff --cached

It gives you lovely output such as:



That's all for now. Happy coding, everyone!

Wednesday, July 16, 2014

Fastest Summer of My Life!

Time seems to be moving faster and faster. I can hardly believe it's time for another two-week report! I spent a lot of time chasing bugs but I'm making baby steps forward and learning a lot about how Rails and JavaScript work in live code.

Week 7: June 29 - July 5




Week 8: July 6 - July 13

  • And the code I've written was deemed not yet ready for prime time - it only works halfway at this point. I will resubmit after I get the code up to production standard.
  • After some useful feedback on the importance of submitting a pull request with only one commit (and some pointers to how-to's on rebasing to make that happen) and the helpfulness of of including *lots* of screenshots showing the software in action, I closed the pull request.
  • One (!!) of the aspects of this project that I have found especially challenging is finding my way through the blending of JavaScript and Rails code. I spent an inordinate amount of time this week chasing down what turned out to be a Javascript syntax error that was manifesting as a Rails error.
    • I've installed the "better_errors" gem to try to assist with errors like this - it will presumably be triggered if it is a true Rails error
    • I've also learned that if I make changes to the JavaScript portions of the code, I have to restart the server in order to see any changes. Most changes to the Ruby code automagically propagates without restarting the server.
  • Screenshots of my progress so far are on GitHub. Searching by year (2008 and 2009) will bring up the Burning Man map layers for those years and recenter the map to that area. Searching by any other year brings up with message that this is a work in progress. (It no longer crashes the map and brings up the dreaded Rails error screen, so there's some progress there!)