“⌘ + w” in VMWare has been frustrating me for months. The situation goes something like this: I have a VM open and active I hit “⌘ + W” like an idiot My VM starts suspending, forcing me to wait for suspending and resuming to complete I needed a way to stop myself from accidentally… Continue reading A less frustrating suspend shortcut for VMWare Fusion
Author: Paul
Custom Relative Time with Date Components
Here’s an if chain that figures out the relative time. The current version suites my needs but it’s easy to modify. //print date to countdown_label NSCalendar *calendar = [[[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar] autorelease]; NSDate *fromDate = [NSDate date]; NSDate *toDate = [user filtered_until]; NSDateComponents *components = [calendar components:NSDayCalendarUnit|NSHourCalendarUnit|NSMinuteCalendarUnit fromDate:fromDate toDate:toDate options:0]; NSString *countdown_text = @””; if… Continue reading Custom Relative Time with Date Components
Disabling the Print hotkey in OS X
The print hotkey is not useful to me. If it opened immediately and was immediately dismissible with esc it would be less frustrating but as it is every time the print dialogue opens I need to wait several seconds before I can dismiss it regardless of which app it’s in. “⌘+P” has been frustrating me… Continue reading Disabling the Print hotkey in OS X
Custom Theme for Sublime Text 2 and XCode
My personal syntax highlighting theme. I use this in various forms aside from Sublime Text 2 including on this blog for the code examples and in XCode, Sublime Text 2, and where ever else I can get away with it. Color Codes Background – #161714 Text Color – #e6e2da Green – #ADBC68 Dark Blue –… Continue reading Custom Theme for Sublime Text 2 and XCode
Exporting PDFs in Illustrator
There are a few common issues with saving PDFs in Adobe Illustrator. I experienced these with CS5 (5.1 specifically) but while looking for a fix I saw reports of the same errors from users with CS2, CS3, CS4, and CS6 as well. Commond errors include: “This file cannot be found.” when trying to save a… Continue reading Exporting PDFs in Illustrator
Assigning variable defaults in PHP
It’d be nice if PHP had a quick Or-Equals expression like Ruby: user ||= User.new but we make do with few slightly less sugary idioms. The standard way if (isset($user)) { $user = new User(); } A bit shorter $user = isset($user) ? $user : new User(); Shorter still This is my preferred way of… Continue reading Assigning variable defaults in PHP
IE8 select element change event not firing with the keyboard
Change events on select elements don’t fire in IE8 when the user confirms the selection with the enter key until the user clicks elsewhere. If your users are waiting on something in particular to happen after updating the select this is a bit of a problem. Here’s my solution: // jQuery syntax for ease of… Continue reading IE8 select element change event not firing with the keyboard
Getting a particular superview in Objective-C
If you have, for example, a child view of a UITableViewCell and you need to get the UITableViewCell in question you can quickly do something like: UITableViewCell *cell = (UITableViewCell *)the_view.superview.superview; It works but this code is fragile because it requires that the view heirarchy not change (also things like this usually point to a… Continue reading Getting a particular superview in Objective-C
Debugging Javascript with Console
A quick review. Console.log() //how to print a log statement console.log(‘That thing you expected to happen is now happening!’); //how to break production sites in internet explorer console.log(‘anything’); //how to log safer function l(str){if(window.console&&console.log){console.log(str);}} l(‘I can forget this in my code base without breaking anything!’); Console.trace() //how to figure out what’s calling what console.trace(); //console.trace… Continue reading Debugging Javascript with Console