HelloSign for Gmail

HelloSign for Gmail is a browser extension for Chrome, FireFox and Safari that lets users fill out and sign documents without ever leaving Gmail. The user clicks the sign button next to an attachment and the file is uploaded to HelloSign and the HelloSign editor is opened in a lightbox for the user to sign and make annotations. When the user clicks Continue the iframe closes, a compose window opens in Gmail (as if the user had clicked reply) and the signed document is attached, ready to be sent. ...

August 6, 2013 · 2 min · Paul

Tap anywhere else to cancel in Objective C

Whenever you have a modal element that outside touches should cancel a few things need to happen: Touches inside the modal element should behave normally Outside touches should not trigger touch events on tappable elements Outside touches should trigger a handler to close the modal In my case I was swiping a UITableViewCell and revealing a controls view that should close if any other UITableViewCell is tapped. hitTest:withEvent - The easiest method Touch events bubble down from the root view rather than up from the target view which makes this a bit easier. On whichever view needs to capture the touch events, we need to override hitTest:withEvent: to return nil and call a function whenever a modal is open and a view other than the modal is tapped. I overrode this method in my UITableView’s superview. ...

August 6, 2013 · 3 min · Paul

Hiding the WP Admin Bar

There’s a few plugins for hiding the WordPress admin bar that shows up on top of your site when you’re logged in but it seems like overkill. If you don’t care about preventing it from loading you can drop this in your stylesheet at wp-admin/themes.php?page=editcss to hide it. html { margin-top: 0!important; } #wpadminbar { display: none; }

August 3, 2013 · 1 min · Paul

Accepting developer roles on facebook

Log into Facebook and go to https://developers.facebook.com/apps. Register as a developer if you haven’t yet This process is a pain and involves entering your phone number and receiving a confirmation text. Check for invites You should get a notification at the top about any pending invites. Click through and confirm.

August 2, 2013 · 1 min · Paul

A less frustrating suspend shortcut for VMWare Fusion

“⌘ + 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 closing my VMs multiple times per week. The Fix It’s pretty simple, we just remap “⌘ + w” to something else like “⌘ + ⇧ + w” in System Preferences. First, open System Preferences and go to Keyboard > Keyboard Shortcuts > Application Shortcuts. Use “File->Close” as the menu title and VMWare Fusion as the application. ...

July 31, 2013 · 1 min · 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 (components.day > 1) { countdown_text = [NSString stringWithFormat:@"%i days", components.day]; } //1d 4hrs else if (components.day > 0 && components.hour > 1) { countdown_text = [NSString stringWithFormat:@"%id %ihrs", components.day, components.hour]; } //1d 1hr else if (components.day > 0 && components.hour == 1) { countdown_text = [NSString stringWithFormat:@"%id %ihr", components.day, components.hour]; } //1 day ..this probably won't happen else if (components.day > 0 && components.hour == 0) { countdown_text = [NSString stringWithFormat:@"%i day", components.day]; } //12 hours else if (components.hour > 1) { countdown_text = [NSString stringWithFormat:@"%i hours", components.hour]; } //1 hour else if (components.hour == 1) { countdown_text = @"1 hour"; } //48 mins else if (components.minute > 1) { countdown_text = [NSString stringWithFormat:@"%i mins", components.minute]; } //1 min else if (components.minute == 1) { countdown_text = @"1 min"; } //0 min or less else { countdown_text = @"now"; }

July 30, 2013 · 1 min · Paul

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 for a while, being next to “⌘+[”. Now that i’m using Sublime Text 2 as my editor of choice it’s worse because “⌘+P” is ST2’s default quick open hotkey. ...

July 23, 2013 · 1 min · Paul

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 - #4793CB Light Blue - #A5CFE1 Burnt Orange - #D76E28 Orange - #FD971F Grey - #686760 ...

July 22, 2013 · 1 min · Paul

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 PDF in Illustrator Saved PDFs coming out blank white or empty with file sizes 500k+ This file cannot be found ...

July 18, 2013 · 2 min · Paul

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 making sure variables are set. Short and clear. isset($user) || $user = new User(); Expressions with defaults It’s usually best not to treat variable assignments as booleans but in cases like this I think it’s clear enough what’s happening. ...

July 16, 2013 · 1 min · Paul