Skip to content

Instantly share code, notes, and snippets.

@KosmicTask
KosmicTask / gist:d97904304f242308feaad94aa93c0513
Created December 9, 2019 17:11
Make an embeddable copy of Mono on macOS
#!/bin/sh
# make-mono-framework.sh
#
# Generate ./Mono.framework from /Library/Frameworks/Mono.framework.
# The generated framework will be suitable for copying into an app bundle.
#
# Typical usage would be:
# sudo ./make-mono-framework.sh x.x.x
#
@KosmicTask
KosmicTask / NSWindow+KVLoop.h
Created August 23, 2016 14:50
Log NSWindow key view loop starting at the first responder.
@interface NSWindow (KVLoop)
- (IBAction)logKeyViewLoop:(id)sender;
@end
@KosmicTask
KosmicTask / gist:9a3181909b1fe67368f8
Last active March 27, 2021 17:50
NSTableView custom drag image with background and drop shadow based on contents of NSTableCellView -draggingImageComponents
#pragma mark -
#pragma mark NSTableViewDataSource
- (void)tableView:(NSTableView *)tableView draggingSession:(NSDraggingSession *)session willBeginAtPoint:(NSPoint)screenPoint forRowIndexes:(NSIndexSet *)rowIndexes
{
// configure the drag image
// we are only dragging one item
NSTableCellView *cellView = [self.columnsTableView viewAtColumn:0 row:rowIndexes.firstIndex makeIfNecessary:NO];
if (cellView) {
@KosmicTask
KosmicTask / gist:24c0c317f5588331d9f7
Created June 10, 2014 12:50
HockeyApp OS X SDK : Configure NSPrincipalClass == BITCrashExceptionApplication in info.plist for release builds only
if [ "${CONFIGURATION}" = "Release" ]; then
# HockeyApp support
# Set prinicipal class in output info.plist
# This improves the crash catchers behaviour for release builds only.
# NSApplication is preferred for development builds as it logs to the console.
release_plist=${CONFIGURATION_BUILD_DIR}/${INFOPLIST_PATH}
echo "${release_plist}"
/usr/libexec/PlistBuddy -c "Set :NSPrincipalClass BITCrashExceptionApplication" "${release_plist}"
@KosmicTask
KosmicTask / BPImageView.h
Created April 7, 2014 15:31
NSImageView subclass that responds to mouse up and sends click event
@interface BPImageView : NSImageView
@property SEL clickAction;
@end
@KosmicTask
KosmicTask / DBNumber.h
Last active August 29, 2015 13:56
NSNumber subclass example
//
// DBNumber.h
// Dubrovnik
//
// Created by Jonathan Mitchell on 24/02/2014.
//
//
#import <Foundation/Foundation.h>
#import "DBMonoIncludes.h"