Sometimes when focusing on a specific area/method in a project, you may not want to run the full test suite every time you make a change. This is especially true in Rails projects, since tests can take a while to run.
Here’s how to run a single method of a test:
ruby -I test test/path/to/the_test.rb -n test_method_name
You can also run all tests in a single file with:
ruby -I test test/path/to/the_test.rb
The above works for Rails tests, since the test helper loads the Rails environment, but this is an alternative way to run tests in a single file in the context of Rails:
rake test TEST=test/path/to_file.rb
And as a general Rails testing note, if there are database issues, run
db:test:prepare before running tests, (runs all database migrations).
For Sublime Text 2 users, the RubyTest package is worth a mention. It can run a single test or all tests from within Sublime: https://github.com/maltize/sublime-text-2-ruby-tests
Update Command-line Tool heroku update
Help heroku help
Create App heroku create --stack cedar [<appname>]
Deploy App git push heroku master
Open App in Web Browser heroku open
Useful Info About Your App
Basic App Info heroku info
View App Config heroku config
Show State of App heroku ps
Show App Logs heroku logs
Advanced (Run Tasks/Database/Scaling)
Run task on Heroku (i.e. Rake tasks) heroku run rake task:name
Pull/Push Database (Use with Caution! Potentially Destructive.) heroku db:pull
Scale Web Process heroku ps:scale web=1
Set timezone for app. (Use TZ time zones from here [wikipedia].) heroku config:add TZ=America/Vancouver
For more, see here: http://devcenter.heroku.com/categories/command-line
Avoid Free App (1 Web Dyno) Idling
Install New Relic Addon (Free): http://addons.heroku.com/newrelic
And Configure: http://devcenter.heroku.com/articles/newrelic
And then setup Availability Monitoring in “Menu > Settings > Availability Monitoring”
1Password is a great program, but one thing it doesn’t handle well is multiple password databases. I use 1Password at work and at home, and sometimes I want to access my home password database. To view another database, you have to go to “Preferences“, and “Choose Another Data File…“, find your file, then repeat to switch back to your main database. Pretty clunky.
Luckily, for read-only access, you can open the 1Password.html file and view your passwords in a basic interface using a web browser (if you’re using Finder on Mac OS X, right-click your 1Password.agilekeychain file and choose “Show Package Contents” to see the HTML file).
However, if you’re using Google Chrome, you will see this:
How to Fix the “Problem loading 1Password data file” Error
A simple solution is on the 1Password web site:
The easiest way to workaround this is to store your 1Password.agilekeychain file on a web server or service like Dropbox. If you need offline access to 1PasswordAnywhere you will need to use another browser or modify Chrome’s settings by adding the –allow-file-access-from-files command line option.
A more complex solution is below.
Note (May 31, 2012): This was accurate as of April 2011, and may not work on the newer Kindles. I used this information to get custom screensavers on my Kindle Keyboard (as it is now called).
Download the Jailbreak Here: http://yifan.lu/p/kindle-jailbreak
Follow this guide to get custom screensavers working: http://wiki.mobileread.com/wiki/Kindle_Screen_Saver_Hack_for_all_2.x_and_3.x_Kindles
Moving around the terminal one character at a time is slow and gets annoying, so here’s how to move around word by word:
ctrl-a: move to front of line ctrl-e: move to end of line ctrl-w: delete word before cursor
By default, the shortcuts for moving left and right are Esc-b and Esc-f. It’s much handier to use Alt/Option-left and -right, so this is how you can configure terminal to do that:
To configure it to Alt + left and right:- Open Terminal preferences (command + ,);- At Keyboard tab, select "control cursor left (or right)" and doubleclick it;- Left: Select the combo "modifier" to "option" and the action to