Install Ruby 2.1.1 Ubuntu 12.04

Open terminal

Terminal menu -> Edit -> Profile Preferences -> Title and Command -> Run command as a login shell

Close terminal & open again

sudo apt-get install build-essential git-core curl libmysqlclient18 nodejs
curl -L get.rvm.io | bash -s stable
rvm install ruby-2.1.1
rvm use ruby-2.1.1

C# – Sorting a List of Objects

// Use IComparable Interface and implement CompareTo method. Uses the standard -1, 0, 1

class MyObject: IComparable
{
    public string Label;

    public int CompareTo(object obj)
    {
        if (obj == null) return 1;
        MyObject otherObject = obj as MyObject;
        if (otherObject != null)
            return this.Label.CompareTo(otherObject.Label);
        else
            throw new ArgumentException("Object is not a MyObject");
    }
}

List myObjects = createMyObjects(); // defined elsewhere
myObjects.sort();

LINQ Multi-Dimensional GroupBy

var transactions = new[] {
  new { Customer = "Andy", Amount = 28, Year = 2012, Month = "Jan" },
  new { Customer = "Bob", Amount = 101, Year = 2012, Month = "Jan" },
  new { Customer = "Claire", Amount = 28, Year = 2012, Month = "Feb" },
  new { Customer = "Andy", Amount = 28, Year = 2013, Month = "Jan" },
  new { Customer = "Claire", Amount = 28, Year = 2013, Month = "Jan" },
  new { Customer = "Claire", Amount = 73, Year = 2013, Month = "Feb" },
};

var res = transactions
  .GroupBy(t => new { t.Year, t.Month });

foreach (var g in res)
  Console.WriteLine("{0} => {1}", g.Key, g.Sum(t => t.Amount));

Outputs:
{ Year = 2012, Month = Jan } => 129
{ Year = 2012, Month = Feb } => 28
{ Year = 2013, Month = Jan } => 56
{ Year = 2013, Month = Feb } => 73