Hi, I'm Sam.

I like to make stuff, play music, and write on technology.

Find out more about me.

#scribd Posts

I'm Moving to San Francisco

Posted on in freelance, life, moving, music, scribd, and sf

I've been looking for a real job for awhile now. After going back to freelancing again, I decided I really hate freelancing. Dealing with clients, lining up work, handling money, contracts, etc. All of that stuff sucks. I just want to write code and make cool stuff. Dealing with all of that junk is not fun.

I have flown out to San Francisco for a few interviews and done tons of phone interviews as well. I had a pretty sweet interview at Apple for the iChat engineering team (even though I didn't get the job). Steve Jobs and Jonathan Ive walked right by me while I was eating lunch at Cafe Macs (which is awesome by the way). It was epic.

What I'm Doing

I accepted an iOS engineering position at Scribd.

Scribd is the largest website for social publishing and reading.

Scribd believes that all your docs want to be shared across the web and all over the world.

You can find out more about Scribd here if you want to know more.

They want to make a sweet mobile application for reading. I have a unique experience in making mobile readers (Bible and SocialBooks) so it's a perfect fit!

My start date is January 3rd, but I'll be moving the second week of December.

What About...

Finding Chesterfield - Leaving my band (Finding Chesterfield) is one of the hardest parts about moving to San Francisco. I'll really missing playing in person with @mattgrimm. The entire time we've been a band, we have lived in two different cities. We're going to try to keep playing together, but it will be more of a side project than a main focus now. Really hoping to put out a full length album eventually.

Friends - That also sucks. I'll definitely miss my Texas (and Oklahoma) friends, but I'm looking forward to making new ones in California.

My stuff - I plan on selling or giving away a lot of my furniture (so if you want some stuff and can pick it up, email me). I'll probably just get a small U-Haul trailer and pull it behind my xB with some smaller stuff.

Yayz

I'm way excited about what Scribd is doing and being a part of it. They have really sweet offices too. Biking to work will be awesome. Being near all of my tech heros will be awesome. I can't wait!

Clean Up Your Project

Posted on in cocoa, development, ios, rake, ruby, and scribd

Many of the apps I work on are usually 100% custom. There is rarely any system UI components visible to the user. Styling the crap out of apps like this makes for tons of images in my iOS projects to get everything the way the designer wants. I'm starting to drawRect: stuff more these days because it makes it easier to reuse, but anyway.

There are literally hundreds of images in the Scribd app I've been working on. Designers changing their mind plus everything custom leaves a lot of images behind that are no longer used. Our application was starting to be several megs and a lot of it was unused images. So... being the programmer I am, I wrote a script.

desc 'Remove unused images'
task :clean_assets do
  require 'set'

  all = Set.new
  used = Set.new
  unused = Set.new

  # White list
  used.merge %w{Icon Icon-29 Icon-50 Icon-58 Icon-72 Icon-114}

  regex = /\[UIImage imageNamed:@"([a-zA-Z0-9\-_]+).png"\]/
  Dir.glob('Classes/*.m').each do |path|
    used.merge File.open(path).read.scan(regex).flatten
  end

  Dir.glob('Resources/Images/*.png').each do |path|
    next if path.include? '@2x.png'
    all << path.gsub(/Resources\/Images\/([a-zA-Z0-9\-_]+).png/, "\\1")
  end

  unused = all - used
  unused.each do |key|
    `rm -f Resources/Images/#{key}.png Resources/Images/#{key}@2x.png`
  end

  puts "#{all.length} total found"
  puts "#{used.length} used found"
  puts "#{unused.length} deleted"
end

It basically searches all of your source files for references for [UIImage imageWithName:@"image_name_here"]. Then it looks at all of the images on disk and removes any you didn't reference. I setup a whitelist for icons and other images I don't reference directly. You might need to tweak the paths a bit to work for your setup.

Hopefully this little rake task helps someone clean up their project too.