The save hotkey in Chrome needs to be changed for all the same reasons I disabled the Print hotkey. I hit it by accident a few times a week thinking some other application is active and then I have to wait for it to load to get out of it. It’s only a few seconds… Continue reading Disabling the save shortcut for browsers
Month: August 2013
Sharing a single NSDateFormatter instance
Formatting dates in cellForRowAtIndexPath or another method that gets called very often will make an app noticeably slower if an NSDateFormatter needs to be initialized on every call. Storing the NSDateFormatter in a property or making it static are both fine options but if it’s around anyway it might as well be used by the… Continue reading Sharing a single NSDateFormatter instance
Retina alterative to CGRectIntegral
CGRectIntegral is a function for rounding all the values of a CGRect at once, typically used for snapping frames to pixels. For a good example of how this helps prevent image blurring and other related rendering issues see this stackoverflow answer. On retina screens CGRectIntegral still rounds to the nearest point (1.0) rather than the… Continue reading Retina alterative to CGRectIntegral
Mac constantly switching to a new finder window when the space key is pressed
If whenever you press the space key your mac shifts focus to a finder window you should be able to fix it by hard booting Finder. Open terminal and run: killall Finder
Unarchiving 7z files on OS X
Brew is always saving the day. # Install p7zip brew install p7zip # extract 7z x file.7z
Quick Browser Detection One Liners
// You can expand this out in any line below // but it makes things much more readable var ua = navigator.userAgent.toString().toLowerCase(); //Browsers var IE6 = false /*@cc_on || @_jscript_version < 5.7 @*/ var IE7 = (document.all && !window.opera && window.XMLHttpRequest && ua.indexOf(‘trident/4.0’) == -1) ? true : false; var IE8 = (ua.indexOf(‘trident/4.0’) != -1);… Continue reading Quick Browser Detection One Liners
Vertical space in bootstrap
I use Bootstrap for most personal projects lately but one thing that consistently gets me is the lack of vertical spacing classes. Quick fix I added these classes to my bootstrap stylesheet .voffset { margin-top: 2px; } .voffset1 { margin-top: 5px; } .voffset2 { margin-top: 10px; } .voffset3 { margin-top: 15px; } .voffset4 { margin-top:… Continue reading Vertical space in bootstrap
Checking if a UITableViewCell is fully visible
Sometime you need to know if a UITableViewCell is completely visible and for those times there’s this handy UITableViewCell category. //Place in UITableViewCell Category – (BOOL) isCompletelyVisible { // For parents category see pdenya.com/g/uiview_parents UITableView *tableview = (UITableView *)[self parents:[UITableView class]]; CGRect rect = [tableview rectForRowAtIndexPath:[tableview indexPathForCell:self]]; rect = [tableview convertRect:rect toView:tableview.superview]; BOOL completelyVisible =… Continue reading Checking if a UITableViewCell is fully visible
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… Continue reading HelloSign for Gmail
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… Continue reading Tap anywhere else to cancel in Objective C