Skip to content

Instantly share code, notes, and snippets.

View apparentsoft's full-sized avatar

Jacob Gorban apparentsoft

View GitHub Profile
- (void)checkAllTheBadLaunchStates {
NSURL *bundleURL = [[NSBundle mainBundle] bundleURL];
if ([bundleURL.path hasPrefix:@"/Applications"] && [bundleURL ag_isQuarantined]) {
log_error(self, @"Application has been translocated");
NSString *title = OPLocalizedString(@"The system has quarantined 1Password.", @"title: 1Password has been quarantined by macOS.");
NSString *message = OPLocalizedString(@"1Password was not moved to the Applications folder correctly. To fix this issue, 1Password will copy a command to the Clipboard that you can paste in Terminal.", @"message: we're in AppTranlocation jail, updates will fail, no extensions will work.");
NSString *defaultButton = OPLocalizedString(@"Open Terminal", @"button: opens the Terminal app");
NSString *secondaryButton = OPLocalizedString(@"Quit 1Password", @"");
op_showAlert(title, message, defaultButton, secondaryButton, nil, NO, ^(NSAlert *alert, NSModalResponse response) {
if (response == NSAlertFirstButtonReturn) {

This page is now depreacted!

Check out the repo instead. The Wisdom of Quinn Now with 100% more archived PDFs.

The Wisdom of Quinn

Informative DevForum posts from everyone's favorite DTS member.

(Arranged newest to oldest)

@danielpunkass
danielpunkass / RSDimensionHuggingTextField.swift
Last active May 30, 2024 01:08
NSTextField subclasses that grow/shrink their width or height to fit text content
//
// RSDimensionHuggingTextField.swift
// RSUIKit
//
// Created by Daniel Jalkut on 6/13/18.
//
import Cocoa
// You probably want to use one of RSHeightHuggingTextField or RSWidthHuggingTextField, below
@mayoff
mayoff / !README.md
Last active August 14, 2023 15:09
Debugging Objective-C blocks in lldb

The attached lldb command pblock command lets you peek inside an Objective-C block. It tries to tell you where to find the source code for the block, and the values captured by the block when it was created.

Consider this example program:

#import <Foundation/Foundation.h>

@interface Foo: NSObject
@end

@implementation Foo

@andymatuschak
andymatuschak / CollectionViewDataSource.swift
Last active February 12, 2021 09:44
Type-safe value-oriented collection view data source
//
// CollectionViewDataSource.swift
// Khan Academy
//
// Created by Andy Matuschak on 10/14/14.
// Copyright (c) 2014 Khan Academy. All rights reserved.
//
import UIKit
@Sija
Sija / NSArray-Blocks.h
Created November 15, 2009 05:22
Making NSArray more ruby-ish
//
// NSArray-Blocks.h
// Handy codebits
//
// If you want to keep block definitions terse, simple and dynamic, have no
// problems with the incompatible block pointer types and you don't mind
// compiler warnings about sending a message without matching signature,
// DO NOT IMPORT THIS FILE, seriously.
//
// Created by Sijawusz Pur Rahnama on 15/11/09.