Uncommon Sense

Derek Sivers is the creator of CD Baby, the first online distributor for independent music artists. There is no question that Derek is a success story, he started CD Baby as a hobby and ended up selling it for millions of dollars. However money is not everyone's idea of success, some people would prefer to be famous or have more time to travel the world. This short series will give you the perspective you need to realise your goals and work towards them.

git fetch --prune

If you work on a team which makes heavy use of feature branches, you might find yourself manually deleting branches which have been removed or merged into master on the remote. This usually doesn’t happen often enough to become a serious annoyance, but there is an easy way to keep your local branches in sync. When you pull changes down from a remote try git fetch —prune. it will prune any remote tracking branches which have been deleted.

As always, check the help files for any other useful configuration options:

git help fetch

GIT log for current branch

By default the git log will display commits from the parent branch as well as the current branch. Just like all git commands, this is meant to be a reasonable default which you can configure to suit your needs.

What I have found most useful is to show commits between two commits. What this means is that the following will display commits from the current branch only:

git log master..wip

Equally simple is showing commits made today:

git log —since=yesterday

There are a few other options related to date ranges and authors which I encourage you to check out the help file:

git help log

generating a secret with rails

Rails comes with a lot of helpful tools out of the box, thats part of what makes it such a pleasure to work with. It frequently feels like they have thought of pretty much everything, like it has been developed by a team who really cares about web development and lives through many of the daily tasks involved in web development.

Lately I have needed to manually generate random API keys for users, and the easiest way that I found was date | md5. It works, thats for sure. But something just feels a little too hacky about it.

$ date | md5 1ca29c478d607031ca6c5864046057a2

Thats when I discovered that rails comes with a rake task for generating keys intended to be used as the session secret for your project. Just run rake secret in your project root.

$ be rake secret 1c6e4ff8a3cf25e255ba8161b77cf40ea572a90541c8d111b51203e35d95a5c08bc826660911c09b48554efdbb45e58de1ee37080b505764c79ff2df40bc4a82

If you would like to read about more cool things you can do with rails on the command line, check out the guide.


Switching from RVM to RBENV

After using RVM for a while I have make the switch to RBENV. They both work perfectly fine, but people have preferences and mine if RBENV. These are the steps required to make the change:

1. Uninstall RVM

You cannot run RVM and RBENV together, you have to choose one or the other. RVM is really easy to remove, it comes with a command to self district and completely remove itself from your system:

rvm --implode

This did 99% of the work for me … but for some reason it could not remove all the files from ~/.rvm so either go ahread and remove it afterwards or running the implode command with sudo would probably do the trick as well.

1.1 Uninstall Gems (from system ruby)

I had a lot of gems installed on my system (the base ruby installation) from before I started using RVM. You can remove them all with the following command:

gem list | cut -d" " -f1 |  xargs gem uninstall -aIx

2. Install RBENV

The easiest way to install rbenv is with homebrew (http://mxcl.github.io/homebrew/), so I suggest you head over and get that installed if you don't already. Once you have that sorted out use brew to install the following two apps:

brew install rbenv

While rbenv is your typical ruby version switcher, ruby-build allows you to easily install any ruby version.

2.1 Install RBENV continued

For some reason rbenv did not install properly for me. The files were install but my bash profile was not updated. The following two lines need to be in your bash profile.

export PATH="$HOME/.rbenv/bin:$PATH"

2.2 Installing Rubies

You will need to install each version of ruby you intend using.

Use 'rbenv install --list' to see a list of all available versions, then 'rbenv install <version>' to install that version.

3 Prepare Your Projects

Your projects probably have a few '.rvmrc' files laying around which are now obsolete.

Do this for each of your projects:

  • run 'rbenv local <version>' where <version> is the version listed in 'rbenv versions'. This will generate a '.ruby-version' file in the local directory which rbenv will use to determine which ruby version to use for this project.
  • remove '.rvmrc' file if it exists

Color - a crazy color picker by Devin Hunt

Color is a crazy new color picker and color swatch creator by Devin Hunt. As you can see from the screenshots it fills the whole browser window, with horizontal mouse movement changing the colour and vertical movement changing the brightness of that colour. When you click it will be added to the swatch.

The best part is that it will show you the hexadecimal value for any colour it displays, and if you share or bookmark the URL it will contain the colours you have already selected.

Bombermine - Bomberman MMO

So today I came across an interesting game, an online game called Bombermine. Its an MMO resembling Bomberman, and actually quite a bit of fun. They have implemented way more than the ‘original’ bomberman including a ‘Nyan Bomb’ and ‘Nuclear Bomb’, which are both self explanatory, right?

For the curious and nerdy among us, it looks like they are using jQuery, Underscore, and Angular (http://angularjs.org) to create the site. The graphics rendering is done using a custom game engine and HTML5 canvas.

Crude Grid Layout

I'm a big fan of using as little code to accomplish as much as possible. Recently I have been using Bootstrap a lot (which is an awesome framework) and thought to try my hand at a simple responsive grid layout.

It turns out you can go a long way with very little code. I used SASS because it allows for generating selectors in a loop which significantly reduces the amount of code, and makes the layout more configurable.

There are some kinks which need ironing out, like how the smaller blocks do not fill the entire row width in some browsers, which bootstrap has problems with as well by the way.

Sinatra - Super Quick

I've been using Sinatra every day for a while now and often tell people who simple it is to use. This is an extremely short ( 40 seconds )  demo showing how quickly you can create an application. Obviously you more work is required if you would like to create something useful, but this was done more out of my own curiosity and to see how long it would actually take.

I also cut some corners. I assumed that the gems were already available locally and even cut that bit of the video to make it shorter, and I installed shotgun which probably isn't required but a lot of people use it during development.

BLOKK & Redacted

Ever done a mockup or wireframe and thought that the lorem ipsum text looked just a little too refined for your liking? Here are two fonts which can help make them look a little more conceptual and a little less refined.

BLOKK looks very much like redacted text (black bars) and is good for very high level wireframe sketches which display the outline of large elements.


Redacted also contains the black bars, but also contains another font which resembles rough text. It is also open source and available on GitHub.


Both fonts supply you with the TTF as well as everything you need to render them in a web page.


There are a lot of people out there like me (and possibly you) who have their eyes glued to a computer screen right up until its time to get some sleep. Whether you realise it or not, the type of light an LCD screen emits is similar to that of the sun. This tricks your body into thinking its daytime and to be awake and alert, which in turn makes it difficult for your body to shut down and get some sleep.

Turns out that someone has attempted to solve part of this problem with an application called "f.lux". What it does is change the colour of your screen in an attempt to remove the sunlight colour. The result is a orange coloured screen after sundown, followed by a slightly better night sleep. This is by no means a silver bullet but after a few hours of use I could notice that it was reducing the amount of eye strain, and disabling the app clearly revealed that the bright light that I was normally looking at was much harsher than I realised.

Its free, so give it a shot.


Rotated Feedback Button

I recently implemented some of those little rotated feedback buttons which you often see statically positioned down the side of a web page. They do not look difficult to implement, but unless you use an image you will need to have some CSS skills.

So I have done a basic implementation and made it public to show you my approach to this problem.


Find the code here on JsBin: http://jsbin.com/avarew/1/

I have made the elements semi-transparent to show you how they overlap and to encourage you to look at the code and pick it apart.

Most Awesome Modal Popup

I have been on the lookout for great open source code for web development lately, and today came across LeanModal, a simple modal popup dialog which uses jQuery. The source code weighs in at 4kb (780 bytes when minified) and its extremely easy to use.

Anyone who has not implemented a modal popup because its too difficult hasnt got an excuse anymore! LeanModal is extremely lightweight and super easy to implement.


Overflow Upwards

I recently encountered a scenario which requires page content to overflow at the top instead of the bottom, much in the way that text in the terminal (or console) applications work. Something like this:


At first I thought this would be complicated, possibly requiring some javascript, but someone showed me a very simple way to achieve this behaviour using just a small bit of CSS. Basically two nested div elements with position relative on the parent and min-height 100% on the child.


The one caveat is that you have to set the height's as absolute values unless you know how to make elements 100% of the page height. 

iOS Simulator Screenshot

Until now I thought that the only way to take a screenshot of an iOS app running was to run it on a real device and use the Xcode Organizer and click the “New Screenshot” button. I thought it was odd that the iOS Simulator did not provide this functionality and immediately started looking though the menu. I dont know why but I decided to use the Help menu to search for a screenshot button, and this is what I found.


If you are not searching with the Help menu, that item will just say “Copy”. Go ahead and try it.

Rate My App Dialog

This is not a problem anymore, but in the past iOS would attempt to solicit feedback from users when removing an application from the device. This let to some negative feelings in the development community who were experiencing a lot of negative feedback because users were only being encouraged to provide feedback when they were removing an application, which usually meant they were not happy with it.

For some developers the solution was to solicit feedback at a more appropriate time, like when the application was starting, or just after they had unlocked an achievement (and presumably felt good about using the application).

During the time that I was interested in iOS development I wanted to implement a feature like this and could not find a pre-built solution so started to make my own. While in progress I found that there was indeed another solution, but continued to finish what I had started.

This is the end result:


You can find the source code and some example code on GitHub.

Xcode - Pre / Post build tasks

If you have ever wanted to run some scripts as part of an Xcode build, it's easier than you think with version 4. Follow these brief instructions to add custom tasks to your build process.

Firstly select the project file in the navigator, then select the target you wish to add a task to. Then select the "Build Phases" tab.

By default you will be presented with the following four "build phases":

Those are the steps which Xcode performs to convert the code you type in it into the code which your computer can understand.

Click the "Add Build Phase" button and select "Add Run Script" to add your own item to the "build phases" list.

The approach Xcode seems to want you to take is to type your script directory into this screen. If you do opt for that approach then there is a whole lot of placeholder values that are provided to you which can make life much easier.

The other fields on that screen will be immediately familiar (their purpose) to anyone who has done some shell scripting, so there is no need to explain them.

Some notes:

  • Documentation on the placeholder values.
  • You can rename the build phase by double clicking its title (you can see above that I have renamed mine to "Run Script - Compile Fact List".
  • Drag the build to be in the order which you would like it to be for formed. (This can make it a pre-build task or a port-build task.)
  • The script will be run from the root directory of your project.

Removing Resharper

If you have ever uninstalled or disabled ReSharper and then realised that Visual Studio is not the same anymore (the intellisense and error hilighting does not work) then this is for you:

Click "Tools" then "Options" to bring up the options window.

If you are primarily using C# then select "Text Editor" then "C#", then:

Select "General" and re-enable "Auto list members" and "Parameter information".

Now select "Advanced" and re-enable "Underline errors in the editor" and "Show live semantic errors".

That should do the trick … visual studio is back to its old self and behave the way you expect it to.

iOS Wallpaper

There are a number of wallpaper apps on the App Store which promise to have the best or largest selection of wallpaper images. I'm sure some of them are great but none of them can compare to the selection on google.

Google's advanced image search parameters make it easy to find images with the right dimensions. Just specify the size and search for "wallpaper", or something more specific if you have something in mind.
If you are also a Dropbox user, consider browsing for wallpaper on your desktop, transferring it to a folder on Dropbox, then browsing this folder on your iOS device when you are in the mood for a wallpaper refresh.

My Dell XPS M1330

Well I have ordered (and recieved) a Dell XPS M1330. It is a really nice machine with everything that I need.

The machine I got is based off the cheapest configuration. I kept the slow Intel Core 2 Duo T5450 (1.66GHz) processor since I wont be doing anything too processor intensive (and because I’m on a budget). I went with the 6 cell battery and thre in a Wireless-N card. I also went with 2Gb of memory because we are still mostly using 32bit operating systems and don’t want to run into messy memory problems. Apart from that the system is standard, nothing fancy.

Of course while waiting for the system to get delivered I was doing a bit of searching to see what other people thought of the system, and found a number of problems which arise with this particular system (happens with every system these days). There are a number of possible problems, the most serious being a loud optical drive when you eject or insert media. Nothing too bad.

The first thing I did when I got the machine was to reinstall windows and get rid of those silly recovery partitions, Dell MediaDirect and all that crap. Simply put, the standard Windows Vista install disk accepts my Dell serial number, but the install does not work and Windows will not boot for some reason … you need to use the Dell Windows Vista disk )recovery disk or whatever they call it). Either way this will most likely only be until KDE 4.0 is released when I will probably install Debian or Kubuntu.

So once Windows is up and running I went through it pretty thoroughly to make sure I didnt have any of the obvious problems that other people were facing. Unfortunately I found a relatively rare one … when ejecting media from the optical drive the machine will freeze for about one or two seconds. This is definately at a hardware level because it happens while in BIOS too. So anyways I have called Dell about it and showed them some forum chatter from other people who have experienced the same issue. They are going to send someone out to replace the drive. I seriously hope that works because what do you think they will do next?