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
// 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];
// 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,
// 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;
//
// 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>
//
// 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>
@mkhl
mkhl / backup
Created March 4, 2010 08:48
Simple backup to an external volume with `bup`
#!/bin/bash
set -e
VOLUME=Tigh
function die {
echo "`basename -- "$0"`:" "$@" 1>&2
exit 1
}
# Print messages when a method is replaced.
# Source: http://blog.clickablebliss.com/2010/01/19/finding-colliding-category-methods/
OBJC_PRINT_REPLACED_METHODS=YES
NSLog(@"Something happened in %@ at line %d", NSStringFromSelector(_cmd), __LINE__);
// Even more logging: http://developer.apple.com/mac/library/qa/qa2009/qa1669.html
@mkhl
mkhl / goog-xcode.yaml
Created January 18, 2010 13:16
Xcode defaults to comply with the Google ObjC style guide, in YAML
# Xcode defaults to comply with the Google ObjC style guide
com.apple.Xcode:
IndentWidth: 2
TabWidth: 2
PBXUsesTabs: NO
XCCodeSenseFormattingOptions:
PreMethodTypeSpacing: ' '
PreMethodDeclSpacing: ''
PreColonSpacing: ''
@mkhl
mkhl / snippet.sh
Created August 23, 2009 21:57
Git bundle "replacement"
#!/bin/bash
require_cmd gitx
gitx
# Input: None
# Output: Show as Tool Tip
# Key Equivalent: ⌃⇧G