On Managing Money
Posted on
I generally suck at managing money. My usual attitude to paying for anything is "I need this, so here is the money." When people ask me how much things cost, I never know. This is stupid.
I've kinda of brainwashed myself into thinking I don't have a choice except to pay for this. Doing pretty well as a software engineer in San Francisco makes this a possibility. I realize how stupid this is.
Anyway, I'm starting to hopefully break the habit.
UITableViewCell Silly Magic
Posted on
Ever had a UITableViewCell
's imageView
not update when you set it's image
in a callback or block? It's amazingly frustrating. I usually end up going over and over the code to make sure it sets it on the main thread, the image isn't nil
, the image view is on the screen, etc, etc.
UITableViewCell
s don't update when you set the imageView
's image
. UITableViewCell
's imageView
is magical and stupid. If you don't have an image in the imageView
, it will nil it out and remove it from the contentView
. When you set the image, it will cache it and do some silliness so your updates don't work.
Make your own image view. Easy as that. Don't use the imageView
property unless you want it to work exactly the way Apple uses it in Music.app for albums. For anything else, just make your own and add it to the contentView
.
Always Initialize to Nil
Posted on
Here's an excerpt from a great blog post on why you should always initialize your variables to nil
.
“Always initialize your object variables to nil, no matter what, because some day they may be captured by a block and if they contain junk when the block is copied you’re going to crash.”
It's just good practice, but this really sums it up. Thanks for the write up Ryan Perry!
Open Source is Rewarding
Posted on
I released SSToolkit awhile ago. It's an open source library for doing common things in iOS. It's the overflow of stuff that I use on a daily basis. It's pretty much everything I've ever written that is iOS related that is reusable, open sourced, and released for free.
I recently received this email from a developer using my framework.
Dear Sam
Thank you for SSToolkit. I'm using it to display images from a folder.
your code is easy to use and the instructions to import it into an Xcode project, on your website, are clear and simple.
Regards Ehab
My Deploy Script
Posted on
Here's my basic rake task I use to deploy my blog:
Notice I run rake assets:precompile
after I deploy to Heroku. I am using asset_sync to host my assets on S3 instead of Heroku. There is a known issue with Heroku and this gem, so that's my workaround. Having it in my little rake task means I won't forget any more :)