Screen Shot 2016-02-19 at 17.00.27

Convenient NSTextAttachment image resizing

Today i was faced with the task of building a dynamic NSAttributedString consiting of arbitrary text and icons. Obviously all the icons had to match the text size. Starting point This can be accomplished by just setting the bounds of the NSTextAttachment like so: textAttachment.bounds = CGRectMake(0, 0, 16, 16) Sure, that works but it’s not a very…


Cleaning up your Gmail account with a handy script

When i logged in to Gmail this morning i clicked “All Mail” and saw that i had over 44000 emails in my account. Sure, the search feature is great but i still find it annoying that year old notifications from linkedin litter my mailbox. So i started searching with queries like “from:linkedin.com” and mass-deleting these emails.…


GCD

Keeping it to the main thread

You probably know that UIKit is not thread safe, so for instance if you want to display an alert following a network request you need to make sure that it runs on the main thread. Most developers will resort to dispatch_async to help them with that. – (void)showErrorMessage { dispatch_async(dispatch_get_main_queue(), ^{ [[[UIAlertView alloc] initWithTitle:nil message:@"Something's wrong"…


automate

Automated Xcode 6 Bot TestFlight Uploads

Once upon a time, there was a script for uploading Xcode Bot builds to TestFlight automagically. You can find it here but sadly it doesnt work with Xcode 6, like everything else. I’ve created a new script that will do the same job. It’s been tested with Xcode 6.1.1, Xcode Server 4.0 and Yosemite 10.10.1.…


SSH Shared Connection Config

Improving the SSH connect time with shared sessions

If you find yourself frequently reconnecting to the same servers, you can save some time by using shared sessions. Shared sessions are very easy to enable. These steps work on Mac OS and most flavours of Linux. Open your .ssh/config or create it if you don’t have one. nano ~/.ssh/config Paste the following lines: Host…