Skip to content

Instantly share code, notes, and snippets.

View jnozzi's full-sized avatar

Joshua Nozzi jnozzi

View GitHub Profile
@jnozzi
jnozzi / SomeObject.m
Created July 22, 2015 15:56
A simple test if a mounted volume or device at a given path is a disk image (DMG).
#import <DiskArbitration/DiskArbitration.h>
// ...
- (BOOL)isDMGVolumeAtURL:(NSURL *)url
{
BOOL isDMG = NO;
if (url.isFileURL) {
DASessionRef session = DASessionCreate(kCFAllocatorDefault);
@jnozzi
jnozzi / NSURL+FavoritesList.h
Last active July 11, 2016 04:09
NSURL category that provides a simple way to append a fileURL to the end of favorite items or favorite volumes list used in the side bars seen in Finder and the open and save dialog boxes.
//
// NSURL+FavoritesList.h
// FavoritesListTester
//
// Appends the URL to the end of the Favorite Items or Favorite Volumes list
// (found in the side bar of Finder windows and open/save dialogs, etc.)
//
// Notes:
//
// 1. Must be a file URL.

Keybase proof

I hereby claim:

  • I am jnozzi on github.
  • I am joshuanozzi (https://keybase.io/joshuanozzi) on keybase.
  • I have a public key ASDSgMVGwJ2khInZwiyT7nDRGj-f4R8tuD8U3KofxgS8vQo

To claim this, I am signing this object:

@jnozzi
jnozzi / StringMatrix.swift
Created May 1, 2019 14:04
Handy utility for turning a collection of strings into a characterwise matrix for comparison within columns and retrieval of substrings from column ranges. Handles simple Range<Int> <---> Range<String.Index> conversions.
//
// Created by Joshua Nozzi on 4/29/19.
// Copyright © 2019 Joshua Nozzi. All rights reserved.
//
import Foundation
struct StringMatrix {