Skip to content

Instantly share code, notes, and snippets.

View AlanQuatermain's full-sized avatar

Jim Dovey AlanQuatermain

View GitHub Profile
@AlanQuatermain
AlanQuatermain / gist:98622
Created April 20, 2009 17:08
Xcode License Header Script
#!/usr/bin/ruby
require 'osx/cocoa'
require 'date'
OSX.require_framework "AddressBook"
filePath = "%%%{PBXFilePath}%%%"
fileName = File.basename(filePath)
projName = File.basename(File.dirname(filePath))
@AlanQuatermain
AlanQuatermain / gist:100277
Created April 23, 2009 03:24
How to make a UIWebView in a table cell fill the ugly grey bit with rendered data
@interface UIWebView (WebViewManualRedrawSupport)
- (id) _documentView;
@end
@interface NSObject (WebViewManualRedrawSupport)
- (id) _webCoreNeedsDisplay;
@end
@implementation MyTableCellContainingAWebView (GetRidOfUglyGreyBlock)
@AlanQuatermain
AlanQuatermain / symbolicatecrash.pl
Last active August 30, 2015 07:34
Fixed version of symbolicatecrash for iPhone OS 3.0 devices.
#!/usr/bin/perl
#
# This script parses a crashdump file and attempts to resolve addresses into function names.
#
# It finds symbol-rich binaries by:
# a) searching in Spotlight to find .dSYM files by UUID, then finding the executable from there.
# That finds the symbols for binaries that a developer has built with "DWARF with dSYM File".
# b) searching in various SDK directories.
#
# Copyright (c) 2008 Apple Inc. All Rights Reserved.
@AlanQuatermain
AlanQuatermain / Memory.c
Created May 15, 2009 16:05
Utilities for getting memory allocation & free amounts (works on Mac & iPhone).
/*
* Memory.c
* Outpost
*
* Created by Jim Dovey on 23/04/09.
* Copyright 2009 Morfunk, LLC. All rights reserved.
*
* Copyright (c) 2009, Jim Dovey
* All rights reserved.
*
@AlanQuatermain
AlanQuatermain / gist:185377
Created September 11, 2009 15:54
Example of modifying synchronous code to asynchronous with GCD.
// Before:
- (IBAction) optimizeDataObject: (MyDataObject *) obj
{
// going to start work, so show the user that something's happening
[self.progressIndicator startAnimating];
// these two are *usually* quick -- unless the user opens a 1GB file.
// because this is happening in an event handler, it'll stall the event loop, which
// causes the good ol' spinning beachball of death
[self pruneDuplicatesInDataObject: obj];
- (void) functionWhichAnnoyinglyBlocksExecution: (NSFileHandle *) annoyingFileHandle
{
dispatch_async(dispatch_get_global_queue(0,0), ^{
id result = [annoyingFileHandle someBlockingOp];
dispatch_async(dispatch_get_main_queue(), ^{
[myController displayResult: result];
});
});
}
/*
* proplist.go
* PropertyLists
*
* Created by Jim Dovey on 17/11/2009.
*
* Copyright (c) 2009 Jim Dovey
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@AlanQuatermain
AlanQuatermain / smart_status.c
Created December 7, 2009 01:49
A simple C program to display SMART status for all supported disks.
/*
* smart_status.c
* SMARTStatus
*
* Created by Jim Dovey on 6/12/2009.
*
* Copyright (c) 2009 Jim Dovey
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@AlanQuatermain
AlanQuatermain / JavaScriptCore iPhone
Created May 27, 2010 19:38
This is based on SVN checkout of revision 60307
Index: JavaScriptCore/profiler/ProfilerServer.mm
===================================================================
--- JavaScriptCore/profiler/ProfilerServer.mm (revision 60307)
+++ JavaScriptCore/profiler/ProfilerServer.mm (working copy)
@@ -30,7 +30,7 @@
#import "JSRetainPtr.h"
#import <Foundation/Foundation.h>
-#if PLATFORM(IPHONE_SIMULATOR)
+#if !PLATFORM(IPHONE)
/*
* NSException+Backtrace.h
* Utilities
*
* Created by Jim Dovey on 8/7/2010.
*
* Copyright (c) 2010 Kobo, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without