Skip to content

Instantly share code, notes, and snippets.

View mkhl's full-sized avatar
🖤
…at any cost

Martin Kühl mkhl

🖤
…at any cost
View GitHub Profile
//
// NSApplication+DockIcon.m
// Hyperspaces
//
// Created by Tony Arnold on 30/06/09.
// Licensed under Creative Commons Attribution 2.5 - http://creativecommons.org/licenses/by/2.5/
#import <Cocoa/Cocoa.h>
#import <Carbon/Carbon.h>
//
// NSObject+BlockObservation.h
// Version 1.0
//
// Andy Matuschak
// [email protected]
// Public domain because I love you. Let me know how you use it.
//
#import <Cocoa/Cocoa.h>
// Author: Pierre Bernard
// Source: http://www.bernard-web.com/pierre/blog/index.php?id=2624434753771423706
// Caveat: Consider using http://github.com/andrep/RMModelObject instead.
@implementation NSObject (PropertyDealloc)
- (void)deallocProperties
{
Class class = [self class];
unsigned int pCount;
// Source: http://ignorethecode.net/blog/2010/04/20/footnotes/
// Author: Lukas Mathis
// this script requires jQuery
$(document).ready(function() {
Footnotes.setup();
});
var Footnotes = {
footnotetimeout: false,
// Restart your Cocoa application using Sparkle
// Author: Marc Charbonneau
// Source: http://blog.mbcharbonneau.com/2010/06/03/restart-your-cocoa-application-using-sparkle/
NSString *launcherSource = [[NSBundle bundleForClass:[SUUpdater class]] pathForResource:@"relaunch" ofType:@""];
NSString *launcherTarget = [NSTemporaryDirectory() stringByAppendingPathComponent:[launcherSource lastPathComponent]];
NSString *appPath = [[NSBundle mainBundle] bundlePath];
NSString *processID = [NSString stringWithFormat:@"%d", [[NSProcessInfo processInfo] processIdentifier]];
[[NSFileManager defaultManager] removeItemAtPath:launcherTarget error:NULL];
// Technical Q&A QA1361
// Detecting the Debugger
// Source: http://developer.apple.com/mac/library/qa/qa2004/qa1361.html
#include <assert.h>
#include <stdbool.h>
#include <sys/types.h>
#include <unistd.h>
#include <sys/sysctl.h>
//
// DebuggingUtilities.h
// BreakingIntoGDB
//
// Created by Alexandre Colucci on 23/08/08.
// Source: http://blog.timac.org/?p=190
//
#import <Foundation/Foundation.h>
#import <ApplicationServices/ApplicationServices.h>
@mkhl
mkhl / gist:446222
Created June 20, 2010 23:31
QSB on a case-sensitive filesystem
We couldn’t find that file to show.
/*
* ctrl-f1
* -------
* Query or toggle the "Full Keyboard Access" hotkey, Ctrl-F1
*
* make CC=clang CFLAGS="-framework Carbon" ctrl-f1
*/
#include <Carbon/Carbon.h>
@mkhl
mkhl / docbook-register
Created July 3, 2010 12:05
Register Homebrew-installed DocBook on Mac OS X
#!/bin/bash
# Bail out if anything goes wrong
set -e
# Make sure Homebrew and DocBook are present
which -s brew
docbook="$(brew --prefix docbook)"
test -d "$docbook"