Skip to content

Instantly share code, notes, and snippets.


Karl Nosworthy KarlNosworthy

View GitHub Profile
jrturton / gist:89ce72a87e1b0661eccb
Created Oct 2, 2014
Removing a core data store
View gist:89ce72a87e1b0661eccb
// Need to remove anything matching the first part - there are also logging files alongside the SQLite file itself.
// Typical directory contents are:
// Name.sqlite, Name.sqlite-shm, Name.sqlite-wal
NSURL *folderURL = [url URLByDeletingLastPathComponent];
NSArray *contents = [[NSFileManager defaultManager] contentsOfDirectoryAtURL:folderURL includingPropertiesForKeys:nil options:0 error:nil];
tsuyukimakoto / read_exif_data.swift
Created Aug 9, 2014
Read exif data from raw file.
View read_exif_data.swift
import Foundation
import Cocoa
for arg in Process.arguments[1...Process.arguments.count - 1] {
let cgDataRef = CGImageSourceCreateWithURL(NSURL.URLWithString("file://\(arg)"), nil).takeUnretainedValue()
let imageDict:CFDictionaryRef = CGImageSourceCopyPropertiesAtIndex(cgDataRef, 0, nil).takeUnretainedValue()
jrturton / Get keyboard frame in local coordinates after receiving notification
Last active Sep 28, 2016
Getting the keyboard's frame in local coordinates
View Get keyboard frame in local coordinates after receiving notification
CGRect keyboardFrame = [notification.userInfo[UIKeyboardFrameEndUserInfoKey] CGRectValue];
keyboardFrame = [self.view.window convertRect:keyboardFrame fromWindow:nil];
keyboardFrame = [self.view convertRect:keyboardFrame fromView:nil];