SqrHedz

For "Out the Box" Thinkers

AppDrone - Automate the Mundane

Constantly creating new Rails projects can become a very mundane task. Most of the time we will go through a series of copying and pasting to get a desired setup, but that is the opposite of agile.

AppDrone

Daniel Davey from Platform45 has created AppDrone.

AppDrone aims to take the bore out of setting up a Rails app just the way you
like it. It’s a code library that builds generator code that builds your Rails
app code - R A I L S C E P T I O N!

AppDrone comes with a slick and shiny Ember.js UI which makes creating an AppDrone template a breeze. Falling out of your bed is harder work.

Change HTTP_USER_AGENT in RSpec

Sometimes it becomes necessary to change the HTTP_USER_AGENT while testing a Rails app in RSpec.

All you need to do is stub the request object and set the new :user_agent.

1
controller.request.stub!(:user_agent).and_return('Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1)')

The above snippet was tested in Rails 3.2.3, RSpec 2.9.0 and Ruby 1.9.3-p125

Nuke .DS_Store Files Before They Run Amok

Most users don’t even know of, or care about, the existence of Apple’s Desktop Services Store (.DS_Store) file. But as developers, most of us displaying hidden files, there is no way of avoiding this annoying file… Like zombies in a post-apocalyptic world, it is everywhere Finder.app happens to go.

There are a few tools out there that assist in the removal of this file, you could even add the following as a cron job to remove them on a regular basis.

1
sudo find / -name .DS_Store -exec rm {} \;

Stop The Pollution

Running the following command will prevent .DS_Store creation on network volumes.

1
defaults write com.apple.desktopservices DSDontWriteNetworkStores true

But what about your local disks?

There is a way to prevent the creation of .DS_Store altogether.

Download and install Asepsis, the smart solution for .DS_Store pollution. The Asepsis About page does a better job of explaining how it works than I can ever hope to.

Tested and working on OS X Lion (10.7.3)

Sublime Text 2: Possibly the Best Editor Ever!

sub·lime [suh-blahym]
Adjective: Of such excellence, grandeur, or beauty as to inspire great admiration or awe.

This is not going to be a “Why Sublime Text 2 is better than <insert your preferred editor here>” post. But the pure awesomeness of Sublime Text 2 will make your current editor look like a chump. A very slow chump.

Hopefully this post will serve as a guide to give anyone wanting to try Sublime Text 2 instant gratification. Let’s go…

Blogging With Tentacles

As you might’ve noticed I switched to Octopress , the blogging framework for hackers.

The transition to Octopress and Heroku was relatively painless and the custom-domains add-on made it easy for me to use my own domain name.

The final thing I had to take care of was to find a way to redirect my old Tumblr posts to the new Octopress format. I used a great gem called rack-rewrite and used it in my config.ru like this:

config.ru
1
2
3
use Rack::Rewrite do
  r301 %r{^/post/9954351699/?},  "/blog/2011/09/08/here-we-go-again-dot-dot-dot/"
end

I still have a lot of customisation I would like to do, but for now the stock installation of Octopress has everything I need.

#HappyCoding