from_sentence : the opposite of Rails to_sentence

I like the Rails to_sentence method on String class, which converts an array to a comma-separated sentence where the last element is joined by a connector word.

It makes it easy to take a list of names, for example, and make them human-readable, without having to fiddle with join words and last-item-is-special-case stuff:

['one', 'two'].to_sentence          # => "one and two"
['one', 'two', 'three'].to_sentence # => "one, two, and three"

Read More

Installing CyanogenMod Android 4.4.2 on Samsung Galaxy S4 Mini

logo

These notes are based on the instructions at http://wiki.cyanogenmod.org/w/Install_CM_for_serranoltexx

Read More

Setting up an IE6 image for VirtualBox

VirtualBox provides a great way to run IE browsers for testing during development.

virtualbox

Read More

Setting up PhoneGap on Ubuntu for Android app development

This is just some notes I made, mostly taken from http://docs.phonegap.com/en/3.0.0/guide_overview_index.md.html.

I was installing PhoneGap 3.0.0 on Ubuntu 12.04.

Read More

Testing Javascript with QUnit, PhantomJS and JSCover

Javascript is often the part of an application that’s most difficult to test.

There are several pieces that fit together to give a framework for running the tests in an automated build system – QUnit, PhantomJS and JSCover.

Read More

Sublime Text 3 : keyboard shortcut to reveal file in sidebar

To see where your current file is in the folder sidebar, you can install SyncedSideBar.

However, that has some side effects – sometimes, even if you’ve hidden the sidebar, it pops back up when you switch between files, or search.

Read More

Sublime Text 3 : install notes

Get the location of the latest build from http://www.sublimetext.com/3, download it and install it (this is on Ubuntu):

wget http://c758482.r82.cf2.rackcdn.com/sublime-text_build-3047_i386.deb
sudo dpkg -i sublime-text_build-3047_i386.deb

Read More

Copy to clipboard without the mouse using xclip

Another quick command line utility thing, this time to copy the contents of a file onto your clipboard without having to use the mouse (this is on Ubuntu, with the bash shell, incidentally).

First install xclip:

sudo apt-get install xclip

Read More

Serving a website from Amazon S3

Amazon S3 can be used to serve static content, with all the advantages of scaling and redundancy that you get from Amazon.

There are comprehensive guides to setting up a site in S3 – this is a shortened version to highlight a couple of things.

Read More

XDebug, PHP and Sublime Text 2 on Ubuntu 12.04

Getting Xdebug for PHP working with Sublime Text 2 is slightly tricky.

Most of the instructions are at https://github.com/Kindari/SublimeXdebug - these notes are just a bit extra as a reminder to myself.

Read More