Skip to content

Instantly share code, notes, and snippets.

View ccgus's full-sized avatar

August "Gus" Mueller ccgus

View GitHub Profile
The crash stack:
#0 0x7fff88084314 in objc_msgSend_vtable13
#1 0x7fff80380678 in _Block_object_assign
#2 0x10018b0c3 in __copy_helper_block_1037 at LBServer.m:91
#3 0x7fff8038044a in _Block_copy_internal
#4 0x7fff80380526 in _dispatch_Block_copy
#5 0x7fff803a1bff in dispatch_async
#6 0x10018adac in -[LBServer connectUsingBlock:] at LBServer.m:83
#7 0x100003d1d in -[LAAppDelegate connectToDefaultServerAndPullMail] at LAAppDelegate.m:178
The Official Letters Coding Style Guide
=======================================
By Gus Mueller
(now you know who to blame)
First, read Apple's Coding Guidelines for Cocoa:
http://goo.gl/eY7a
And you should be familiar with the modern runtime for 64 bit apps in 10.6:
//
// LBIMAPTestAppDelegate.m
// LBIMAPTest
//
// Created by August Mueller on 1/29/10.
// Copyright 2010 Flying Meat Inc. All rights reserved.
//
#import "LBIMAPTestAppDelegate.h"
#import "IPAddress.h"
tell application "iTunes"
set songLocation to get location of current track
end tell
tell application "Finder"
open document file songLocation using application file "Capo.app" of folder "Mail Downloads" of folder "Library" of folder "gus" of folder "Users" of disk "srv"
end tell
function main() {
var doc = [Acorn open:"/Volumes/srv/Users/gus/Dropbox/AcornStuff/more junk.acorn"];
var layer = [doc firstLayerNamed:"Background"];
var canvasSize = [doc canvasSize];
var inset = 40;
var image = [[[NSImage alloc] initWithSize:canvasSize] autorelease];
var canvasBounds = NSMakeRect(0, 0, 0, 0);
canvasBounds.size = canvasSize;
var pageBounds = NSMakeRect(inset, -inset, canvasSize.width - inset * 2, canvasSize.height);
@ccgus
ccgus / gist:633670
Created October 19, 2010 05:37
NSDataOMGWTFBBQ
#import <Foundation/Foundation.h>
int main (int argc, const char * argv[]) {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
int *x = malloc(sizeof(int));
void *foo = x;
NSMutableData *d = [NSMutableData dataWithBytesNoCopy:foo length:sizeof(int) freeWhenDone:NO];
tell application "Acorn"
set d to open "srv:Users:gus:Pictures:MyImage.acorn"
delay 0.5
tell document 1
flip canvas direction horizontal
undo
flip canvas direction vertical
undo
@ccgus
ccgus / gist:1126639
Created August 5, 2011 00:14
Weak Sauce
#import <Foundation/Foundation.h>
@interface FMFancyObject : NSObject {
}
@end
@interface FMDeallocCheckerObjectHolder : NSObject {
__weak id _holdingObject;
#!/bin/sh
cores=`sysctl -n machdep.cpu.core_count`
cores=`jstalk -e "$cores * 4"`
rm -rf /tmp/llvm
cd /tmp/
svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm
cd llvm/tools
svn co http://llvm.org/svn/llvm-project/cfe/trunk clang
cd ..
OLD:
FMDatabase *db = [FMDatabase databaseWithPath:dbPath];
[db executeUpdate:@"insert into namedparamtest values (:a, :b, :c, :d)" withParameterDictionary:dictionaryArgs];
NEW:
FMDatabaseQueue *queue = [FMDatabaseQueue databaseQueueWithPath:dbPath];
[queue inDatabase:^(FMDatabase *db) {