Skip to content

Instantly share code, notes, and snippets.

@swillits
swillits / CHDiscoveryProtocols.m
Created December 9, 2014 23:56
CHDiscoveryProtocols.m
//
// CHDiscoveryProtocols.h
// CrashHandler
//
// Created by Seth Willits on 11/22/14.
// Copyright (c) 2014 Araelium Group. All rights reserved.
//
#import <Foundation/Foundation.h>
@protocol CHDiscoveryCenterProtocol;
@swillits
swillits / Probie.mm
Last active September 13, 2015 17:15
//
// Probie.m
// Probie
//
// Created by Seth Willits, Keith Bauer on 11/19/14.
// Copyright (c) 2014 Araelium Group. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <objc/runtime.h>
//
// main.m
// Probie
//
// Created by Seth Willits on 11/19/14.
// Copyright (c) 2014 Araelium Group. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <objc/runtime.h>
//
// main.m
// Blah
//
// Created by Seth Willits on 11/12/14.
// Copyright (c) 2014 Araelium Group. All rights reserved.
//
#import <Foundation/Foundation.h>
//
// main.m
// Blah
//
// Created by Seth Willits on 11/12/14.
// Copyright (c) 2014 Araelium Group. All rights reserved.
//
#import <Foundation/Foundation.h>
@swillits
swillits / gist:eda0e08f344ea975206a
Created November 5, 2014 22:39
How NSTextField determines how high the field should be based on the text font
ascender = 13.775909423828125
descender = -3.821929931640625
baseLineHeight = (descender.abs + 0.5).floor + (ascender + 0.5).floor
ascenderDelta = (baseLineHeight * 0.2 + 0.5).floor
fontHeight = ((ascenderDelta + baseLineHeight) + descender).ceil - descender.floor # 23
//
// OSXCrashReporterInfo.h
// OSXCrashReporterInfo
//
// Created by Seth Willits on 10/26/14.
// Copyright (c) 2014 Araelium Group. All rights reserved.
//
#import <CoreFoundation/CoreFoundation.h>
@swillits
swillits / NSTableView_Sorting_Animation.m
Last active September 13, 2015 17:14
Animated moving tables view rows while sorting
[itemsTableView beginUpdates];
double t = [NSDate timeIntervalSinceReferenceDate];
NSArray * oldArrangement = [[self.itemsArrayController.arrangedObjects copy] autorelease];
NSArray * newArrangement = nil;
NSUInteger count = oldArrangement.count;
// "live" indexes of where final objects are currently.
NSUInteger * liveIndexes = calloc(sizeof(NSUInteger), oldArrangement.count);
//
// Crashed Thread: 0 Dispatch queue: com.apple.main-thread
//
// Exception Type: EXC_BAD_ACCESS (SIGSEGV)
// Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000000000
//
// VM Regions Near 0:
// -->
// __TEXT 000000010d268000-000000010d26a000 [ 8K] r-x/rwx SM=COW /Users/USER/Library/Developer/Xcode/DerivedData/CrashSymbolTest-duwezzdulbkaqtffihfubuglwpki/Build/Products/Debug/CrashSymbolTest
//
@swillits
swillits / Unquarantine.sh
Last active February 12, 2024 23:32
(Gatekeeper) Unquarantine files. http://www.sethwillits.com/temp/Unquarantine.workflow.zip Automator service. Stick in ~/Library/Services. Right-click file(s) in Finder, Services -> Unquarantine. Bingo!
function unquarantine()
{
for file in $@
do
xattr -d com.apple.quarantine $file
if [ -d "${file}" ] ; then
while IFS= read -r -d '' subfile; do
if [ "$file" != "$subfile" ]; then
unquarantine $subfile;