rubycoloredglasses


I'm Jason, a web application developer in East Tennessee.


  1. Resetting Paths for Homebrew

    I recently needed to install a program on my Mac using Homebrew. I was instructed to run ‘brew update’, and then the ‘brew doctor’ command which resulted in this message:


  2. Time Management

    I’ve recently became aware of a time management technique known as the Pomodoro Technique. You time a period of work for 25 minutes, then take a short break, then do another period again. This helps you gauge the amount of work you’re getting done in a period of time, and is supposed to help with mental agility.

    My friend uses Vitamin R as an app on his Mac to remind him of how much time he has left during a time period.


  3. Ruby Strftime

    Instead of piecing together Ruby strftime strings to use for various formats each time, I’m making this post to store common variations for me to reference later.

    I used the legend posted by annaswims on ApiDock.com to piece these together. Thanks Anna.

    # Pretty Abbreviated
    Time.now.strftime("%a %b %d, %Y %l:%M:%S %p %Z") # => "Fri Jul 26, 2013  3:06:04 PM PDT"
    
    # Pretty Long
    Time.now.strftime("%A %B %d, %Y %l:%M:%S %p %Z") # => "Friday July 26, 2013  3:06:53 PM PDT"
    
    # Short but Human
    Time.now.strftime("%-m/%d/%y - %-l:%M:%S %p %Z") # => "7/26/13 - 3:10:15 PM PDT"
    
    # Logger Style
    Time.now.strftime("%m/%d/%y - %H:%M:%S %Z") # "07/26/13 - 15:13:53 PDT"
    
    # ISO8601 format
    Time.now.utc.strftime('%FT%H:%MZ') # => "2013-07-26T22:15Z"
    
    # DateTime format used with ActiveRecord
    Time.now.utc.strftime('%F %H:%M:%S') # => "2013-07-26 22:19:09"
    

  4. Uptime Monitoring and Alerts

    Just happened to hear about these solutions recently.


  5. Installing Rails 3.2.13

    Rails 4 is out now, and installs by default. You might need to install Rails 3 for a project. This is how you do it.

    gem install --version '3.2.13' rails
    

  6. POW RVM ZSH

    I’m using a Rails 3 app, and my colleague updated the RVM config to use Ruby 2.0.0. I was having issues getting POW to work with the app. I’m using ZSH as my shell also.

    The following command resolved my issue.

    rvm env . -- --env > .powenv
    

    Props to Linus on StackOverflow for this solution.


  7. Devise_For with Skip

    I just stumbled upon the options for devise_for which let you auto-generate the routes that are needed for a certain devise resource (user), with certain categories of routes skipped.

    For example, if I want to define routes for my User, I can define:

    devise_for :users
    

    This results in the routes for these three categories:

    • Sessions - Sign in, Sign out
    • Passwords - Password reset options
    • Registrations - Creating new user, updating existing user, or destroying your user account

    You can leave one of these categories out of the route definition by using skip. For instance if you want only the Sign-in and Sign-out options, you could define this in your routes.rb file:

    devise_for :users, :skip => [:registrations, :passwords]
    

  8. Project / Task Management Applications

    I’ve worked on various projects that used various task management applications hosted in the cloud (software as a service). I hear about new ones every so often, so I decided to note them here for future reference.

    • Pivotal Tracker - Anyone trying to adopt the agile / scrum method of development has likely used this.
    • BaseCampHQ.com - This is the first Rails application. The reason Ruby on Rails exists. Simple and elegant.
    • Wrike.com - Very flexible. Can be used to multiple people, in different organizations, matching any special hierarchy of tasks.
    • PlanScope.io
    • Asana.com

  9. Refinery Extension Not Named After Model

    A project I’m working on currently relies on Refinery CMS to administrate the pages. Instead of building our own separate admin area for our own custom models, we’re continuing to use Refinery for our non-page models as well.

    Refinery and it’s extensions are generated under their own namespace to ensure that they play nice with any system you install Refinery into. It can provide page management inside of an existing Rails app you have, or it can act as the center of the entire website. I’m pretty sure the main concept is that it leaves the view/layout presentation up to you, but provides the page administration back-end for you.


  10. Splitting a Branch with Git

    There are times that a task you are working on results in an extremely huge amount of changes. Although you may have been careful, and tested each modification out well, there is always a possibility that something will cause an issue in production. If your branch contains modifications that can be released in separately, without interdependencies, it’s a good idea to split the feature branch into separate releases.

    First you’ll want to interactively rebase your branch, squash all commits into a single commit, and then amend the remaining commit so that it’s the most recent.

    git checkout my_feature_branch
    
    git fetch
    
    git rebase -i origin/master
    
    git commit --amend --reset-author