Ben Scheirman


Ruby Style Iteration in Swift

It’s no secret I’m a fan of Ruby. Idiomatic Ruby iteration looks like this:

5.times do |i|
  puts "Iteration ##{i+1}"

This outputs:

Iteration #1
Iteration #2
Iteration #3
Iteration #4
Iteration #5

You can also iterate over collections in this way:

["apples", "bananas", "cherries"].each do |item|
  puts "Eating #{item}"

Regex in Swift

I’ve been playing around with Swift and one thing that struck me as odd/disappointing is the lack of regular expression literals.

First off, the language is new and yes I’ve filed a radar (rdar://17257306 for Apple folks). Please dupe it if you care about this.

What I mean by regular expression literals is this (Ruby code):

if name =~ /ski$/
  puts "#{name} is probably polish"

Fixing GitHub SSL Issue on 10.9.2

By now you’ve most likely heard about the egregious SSL flaw that has existed in OSX and iOS for a while now.

Yesterday, Apple (finally) released 10.9.2 which addressed the flaw, as well as some other features. Upon upgrading, I was more than slightly frightened to see this error when trying to open

Using Rbenv in Cron Jobs

When using rbenv on your server, you need to make sure that any gem command run needs to be executed with rbenv initialized. When you install rbenv locally or on the server, you typically have something like this added to your .bashrc:

if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi

Synchronizing Dotfiles

I’d put this off for far too long, but I finally released my dotfiles on Github. Part of the reason it took me a while is I already had a syncing solution in Dropbox. I’m still using Dropbox to synchronize between my own machines, but I now have them published on Github as well. In addition, I wrote a handy script (with some inspiration from Steve Harman’s dotfile setup) that symlinks the files into the right spot on the target machine:

Creating a Fusion Drive

Fusion Drive

I have a Late 2009 Core i7 27” iMac that was starting to feel old. Many seemingly simple tasks would cause the OS to beachball, which generally made me not want to use the computer.

This slowness occurred despite the machine having a still respectable 2.8 GHz Core i7 processors. In fact, running some benchmarks with Geekbench led me to believe the problem didn’t lie with my CPU; it was my disk.

Unfortunately Geekbench doesn’t have any disk benchmarks, so I used the relatively old Xbench as a baseline. Compared with my Retina MacBook Pro with a 512 GB SSD, this drive was painfully slow.

I’d read about SSD upgrades in the 27” iMac but I was faced with the ultimate trade-off: The raw speed of the SSD with the utter capacity of a traditional hard drive.

75 Essential Tools for iOS Developers

If you were to go to a master woodworker’s shop, you’d invariably find a plethora of tools that he or she uses to accomplish various tasks.

In software it is the same. You can measure a software developer by how they use their tools. Experienced software developers master their tools. It is important to learn your current tools deeply, and be aware of alternatives to fill in gaps where your current ones fall short.

With that in mind, I present to you a gigantic list of tools. Some of these I use daily, others I see potential in. If you have more tools you’d like to see here, just make sure to add a comment.

Speaking at Cocoa Conf PDX

I have the pleasure of speaking at Cocoa Conf PDX on August 15-16th. Cocoa Conf is always a great event, and I especially love traveling to my home state of Oregon. This time around I’ll be giving two talks:

  • The iOS Developer’s Toolbelt
  • Jenkins – Your personal butler for iOS automation

I hope to see you there!

In Search of a Fast External Hard Drive

Ever since I upgraded to a retina MacBook Pro, I knew I’d have to come up with a new strategy for storing data. Even after upgrading to the 512GB SSD, I’m still running out of space. With hundreds of gigabytes for pictures, music, videos, and games a 512GB SSD is perfectly reasonable. But now that NSScreencast is nearing a year old I have more data than I can store on a single drive. Another nuissance was transferring these videos over to my iMac for editing.
A typical 20 minute screencast of mine will eat up nearly 8 gigabytes before encoding, and transfering a file like this over Wi-Fi is painfully slow.

On my previous MacBook Pro I opted to remove the superdrive and install a 2nd 7200 RPM drive for larger storage. This worked well, but the retina MacBook Pro has no such capability, so I went on the lookout for an external drive to store NSScreencast videos.