Skip to content

Instantly share code, notes, and snippets.

@incanus
incanus / gist:1108777
Created July 27, 2011 06:09
This is my /etc/apache2/other/svn.conf for making Subversion play with the Mac's system Apache. On Lion, I had to install CollabNet's Subversion package (the 10.6 one) to get stuff into /opt.
LoadModule dav_svn_module /opt/subversion/lib/svn-apache/mod_dav_svn.so
LoadModule authz_svn_module /opt/subversion/lib/svn-apache/mod_authz_svn.so
<Location "/svn">
DAV svn
SVNParentPath /usr/local/svnroot
AuthType Basic
AuthName "Subversion Repository"
AuthUserFile /etc/apache2/other/htpasswd
Require valid-user
</Location>
#!/bin/sh
# OBJC_HELP=1 causes the Objective-C runtime to spit out help to stderr
# Pulling in osx/cocoa causes the runtime to be loaded via RubyCocoa
# Redirect sterr to stdout so we can pipe the results through pager
OBJC_HELP=1 /usr/bin/ruby -rosx/cocoa -e '' 2>&1
@rentzsch
rentzsch / gist:1216022
Created September 14, 2011 07:14
NSString* JRNSStringFromCATransform3D(CATransform3D transform)
static NSString* prettyFloat(CGFloat f) {
if (f == 0) {
return @"0";
} else if (f == 1) {
return @"1";
} else {
return [NSString stringWithFormat:@"%.3f", f];
}
}
@xjones
xjones / TransitionController.h
Created November 26, 2011 03:48
TransitionController for animating iOS view controller transitions w/o a controller stack
//
// TransitionController.h
//
// Created by XJones on 11/25/11.
//
#import <UIKit/UIKit.h>
@interface TransitionController : UIViewController
@steipete
steipete / ARCCheck.m
Created December 5, 2011 22:26
Don't be a fool and wonder why nothing is working... ADD THIS CHECK.
// ARC is compatible with iOS 4.0 upwards, but you need at least Xcode 4.2 with Clang LLVM 3.0 to compile it.
#if !defined(__clang__) || __clang_major__ < 3 || !__has_feature(objc_arc)
#error This project must be compiled with ARC (Xcode 4.2+ with LLVM 3.0 and above)
#endif
@mrflip
mrflip / maximum_battery_life.md
Created March 19, 2012 08:32
maximum battery life checklist -- use before a long plane flight

Max Battery Life Checklist

Here is a checklist to follow if you want maximum battery life -- for instance if you're about to get on a long plane flight.

10 hour battery life on a non-SSD Macbook Pro 17"

Low power use checklist

With power connected:

@wkiefer
wkiefer / gist:2366514
Created April 12, 2012 11:00
Notes on using NSURLProtocol
// The basics:
// - Write your own NSURLProtocol subclass and register it.
// - Override the 5 required methods
// - Kick off download or cache fetch during |startLoading|
// - Update self.client with progress/completion/failure notifications.
// UIWebView will download requests concurrently via NSURLProtocol.
// If you use the typical NSURLCache hook to download content, you're
// stuck with serial downloads.
@0xced
0xced / NSObject+ARCZombie.m
Created May 19, 2012 17:52
Solves the problem of .cxx_destruct methods not being called when zombies are enabled
#import <objc/runtime.h>
@implementation NSObject (ARCZombie)
+ (void) load
{
const char *NSZombieEnabled = getenv("NSZombieEnabled");
if (NSZombieEnabled && tolower(NSZombieEnabled[0]) == 'y')
{
Method dealloc = class_getInstanceMethod(self, @selector(dealloc));
@kevboh
kevboh / NSString+KBAdditions.h
Created May 22, 2012 01:56
Making UILabel's adjustsFontSizeToFitWidth and minimumFontSize play nice with multi-lined labels
@interface NSString (KBAdditions)
- (CGFloat)fontSizeWithFont:(UIFont *)font constrainedToSize:(CGSize)size minimumFontSize:(CGFloat)minimumFontSize;
@end
@atomicbird
atomicbird / fixpng.sh
Created June 2, 2012 00:05
Bash functions for easily "fixing" iOS-optimized PNG files (based on https://gist.github.com/2854083)
# Fix an iOS-converted PNG
fixpng () {
if [ -z "$1" ]; then
echo "Usage: fixpng <inputFile> [outputFile]"
return -1
else
inputFile=$1
# Only "png" and "PNG" are allowed
pngRegex='.*.(png|PNG)$'