You may be used to using ‘bundle install’ or ‘bundle exec’ often, but here are some commands you might have forgotten about or never heard of.
You don’t have to create your own Gemfile manually for new Ruby based projects. Bundle Init creates a new one for you.
$ bundle init Writing new Gemfile to /Users/myuser/Projects/hey_guys/Gemfile $ ls -la Gemfile -rw-r--r-- 1 myuser mygroup 64 Aug 29 17:40 Gemfile
I’m trying to configure my application so that it stores files in S3 by default when my application is running in the Production Rails environment, with local file storage and a customized file path for development and test environments. Here is my configuration.
I’ve become aware of how important it is to provide a portfolio of things to share with prospective employers. Having a Github profile that shows off all the Gists and public repositories you’ve contributed to serves as a perfect portfolio piece.
Most of the work I’ve done has been on private systems however, and I’ve discarded the code, because I don’t own it and don’t want legal trouble. So what can I do that is practical, helpful, and/or fun!?
Here is my list of pet project ideas that I plan on doing in the future.
I’m working on a Rails 4.0.0 application, using Ruby 2.0.0 for a code challenge I’m working on. Part of this challenge is to deploy my application to Heroku. I haven’t done this before, as I’m accustomed to deploying to a VPS with Capistrano.
Upon my first deploy I discovered that my assets weren’t compiling. It wasn’t even mentioned in the output while deploying. I reviewed the Heroku article on the Rails asset pipeline, but this didn’t offer me any details to resolve my issue.
I discovered that I should add the rails_12factor gem to my production gem group in the Gemfile. Here’s a pretty annotated version that I used.
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:
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.
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.
# 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"
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
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.