TL;DR If you’ve just upgraded Postgres with Homebrew and Postgres won’t start, as long as you don’t care about any data stored locally, remove all versions of Postgres (brew remove --force postgresql), delete the /usr/local/var/postgres/ folder, then reinstall Postgres.
I’m currently doing some Rails consulting for a company that uses Postgres in their app. After cloning the app to my computer, I wanted to make sure I had the latest version of Postgres.
While working on the Ohana API during the Code for America fellowship, I came across a strange situation. My feature specs didn’t include require "spec_helper" at the top of each file, yet I was able to run all of the specs like so:
Or just all of the feature specs:
$ rspec spec/features
And individual ones as well:
$ rspec spec/features/signin_spec.rb
Then when I cloned the repo to a new directory (to test the installation instructions in the README), I noticed that I could no longer run specific tests. If I tried to run rspec spec/features/signin_spec.rb for example, I would get this error:
/Users/monfresh/Desktop/ohana-api/spec/features/signin_spec.rb:1:in `<top (required)>': undefined method `feature' for main:Object (NoMethodError)
from /Users/monfresh/.rvm/gems/ruby-2.0.0-p353@ohana-api/gems/rspec-core-2.14.5/lib/rspec/core/configuration.rb:896:in `load'
from /Users/monfresh/.rvm/gems/ruby-2.0.0-p353@ohana-api/gems/rspec-core-2.14.5/lib/rspec/core/configuration.rb:896:in `block in load_spec_files'
from /Users/monfresh/.rvm/gems/ruby-2.0.0-p353@ohana-api/gems/rspec-core-2.14.5/lib/rspec/core/configuration.rb:896:in `each'
from /Users/monfresh/.rvm/gems/ruby-2.0.0-p353@ohana-api/gems/rspec-core-2.14.5/lib/rspec/core/configuration.rb:896:in `load_spec_files'
from /Users/monfresh/.rvm/gems/ruby-2.0.0-p353@ohana-api/gems/rspec-core-2.14.5/lib/rspec/core/command_line.rb:22:in `run'
from /Users/monfresh/.rvm/gems/ruby-2.0.0-p353@ohana-api/gems/rspec-core-2.14.5/lib/rspec/core/runner.rb:80:in `run'
from /Users/monfresh/.rvm/gems/ruby-2.0.0-p353@ohana-api/gems/rspec-core-2.14.5/lib/rspec/core/runner.rb:17:in `block in autorun'
The solution was to add require "spec_helper" to the top of each feature spec, but what I still haven’t been able to figure out, is why I was able to get by for months without that require statement. If you know why, please send me a Tweet to enlighten me!
May 23, 2012. I’m attending TechCrunch Disrupt NYC with several AOL colleagues to celebrate the release of the TechCrunch iPad app. We’d been given the opportunity to attend the last day of the conference in recognition of our hard work.
Todd Park (the CTO of the United States) and Steven VanRoekel (the US CIO) happened to be speakers that day, and their passionate and spirited talk on innovation in the government blew me away. I started following Todd Park on Twitter, and that same day, he mentioned Code for America in a tweet. I had not heard of them before, and the name sounded intriguing, so I proceeded to follow them as well. Shortly thereafter, I found out about the open application for their Fellowship program.
This is a quick guide for installing PostgreSQL (Postgres for short) on a Mac with Homebrew, and starting and stopping it with Lunchy. If you’ve just forked a Ruby on Rails project that requires Postgres, this tutorial will get you up and running in no time.
In preparation for backing up my large Dance Music library to Dropbox (in order to sync it between my iMac and MacBook Air), I wanted to start by deleting all the songs I won’t miss. Finding individual files over a certain size is easy via the Finder, but I wanted to find out which folders (i.e. albums) were over 500MB so I could tackle them first.
There is no Folder size option in Finder’s search (afaik), so I did some Unix command research and found the wonderful du (short for disk usage). By default, du lists the folder sizes as multiples of 512 bytes, but you can easily change that to 1024 bytes with the -k flag. So, if you wanted to see the size of all your Dropbox folders, you would run the following command in Terminal:
In this tutorial, I’ll show you two ways to quickly access your clipboard history. The easiest way is with Keyboard Maestro, an app I can’t recommend highly enough. If you value your time, it’s a must-have app that lets you automate so many things on your Mac.
While writing code, you might find yourself spending a lot of time searching for error messages on Stack Overflow or on your favorite search engine. With Quicksilver, you can speed up that process by creating a trigger that will allow you to select text, then initiate the search on a specific website with a keyboard shortcut. Here’s how to set it all up.
While testing a “swipe to delete” feature in an app, I wrote a custom script for Calabash iOS that automates the deletion of all the cells in the Table View. This step definition is generic enough that it can be used in most apps. I hope you find it useful.
If you’re in Terminal all the time, and you regularly type long commands, you can get back those precious moments of your life by creating aliases for those commands in your .bash_profile, which is a file in your Home directory that sets up and customizes your Terminal session.
I’m a big fan of efficiency, and this is one of many timesaving macros you can create with Keyboard Maestro. If you’re already familiar with Keyboard Maestro variables and tokens, you can skip the tutorial and download email URL and title of current web page.kmmacros from my Keyboard-Maestro-Macros repo on GitHub, then import it via File -> Import Macros....
Once imported, it will be placed in a “Browsers” Group that defines the applications in which the keyboard shortcut (aka Hot Key Trigger) for the macro is enabled. I added Safari, Chrome and Firefox to the Group. Before you run the macro, you should at least edit the email address in the Insert Text action. You might also want to change the Hot Key Trigger and/or the email client launched by the macro. Once you’ve tested the macro on your machine, you should add an action at the end that actually sends the email.
For those of you who are new to Keyboard Maestro, let me walk you through the process step by step.