Upgrade to Pro — share decks privately, control downloads, hide ads and more …

It's All in the Tools

It's All in the Tools

These slides are from the 2014 edition my talk "It's All in the Tools" for CocoaConf.

Nathan Eror

April 25, 2014
Tweet

More Decks by Nathan Eror

Other Decks in Programming

Transcript

  1. Debugger Quick Look UIViewController+NEQuickLookDebug.m #import "UIViewController+NEQuickLookDebug.h" ! @implementation UIViewController (NEQuickLookDebug)

    ! #if DEBUG ! - (id)debugQuickLookObject { UIView *view = [self view]; UIGraphicsBeginImageContextWithOptions(view.bounds.size, NO, 0.f); [view drawViewHierarchyInRect:view.bounds afterScreenUpdates:NO]; UIImage *snapshotImage = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); return snapshotImage; } ! #endif ! @end
  2. Makefile SQLITE_DB_FILE=AppData.sqlite SIMULATOR_HOME=$(HOME)/Library/Application\ Support/iPhone\ Simulator ! dbshell: find $(SIMULATOR_HOME) -name

    "$(SQLITE_DB_FILE)" -exec sqlite3 {} ';' ! killdb: find $(SIMULATOR_HOME) -name "$(SQLITE_DB_FILE)" -exec rm {} ';' ! dbschema: find $(SIMULATOR_HOME) -name "$(SQLITE_DB_FILE)" -exec sqlite3 {} .schema ';' ! dbdump: find $(SIMULATOR_HOME) -name "$(SQLITE_DB_FILE)" -exec sqlite3 {} .dump ';'
  3. Shell - Expansions $ ls screen.png $ cp screen{,_copy}.png $

    ls screen.png screen_copy.png ... $ ls screen.png $ touch file{1,2,3} $ ls file1 file2 file3 screen.png
  4. Python #!/usr/bin/python ! from Quartz.CoreGraphics import * from Quartz.ImageIO import

    * ! inurl = CFURLCreateWithFileSystemPath(None, "File.jpg", kCFURLPOSIXPathStyle, False) outurl = CFURLCreateWithFileSystemPath(None, "File_thumb.jpg", kCFURLPOSIXPathStyle, False) thumb_options = { kCGImageSourceCreateThumbnailWithTransform : True, kCGImageSourceCreateThumbnailFromImageAlways : True, kCGImageSourceThumbnailMaxPixelSize : 300 }; imgsrc = CGImageSourceCreateWithURL(inurl, thumb_options) thumb_image = CGImageSourceCreateThumbnailAtIndex(imgsrc, 0, thumb_options) ! outsrc = CGImageSourceCreateWithURL(outurl, thumb_options) ! dest = CGImageDestinationCreateWithURL(outurl, CGImageSourceGetType(outsrc), 1, None) CGImageDestinationAddImage(dest, thumb_image, None) CGImageDestinationFinalize(dest)