Skip to content

Instantly share code, notes, and snippets.

View danielctull's full-sized avatar

Daniel Tull danielctull

View GitHub Profile
//
// UIDevice+DTFeatureCheck.h
// DTUIKit
//
// Created by Daniel Tull on 02.08.2010.
// Copyright 2010 Daniel Tull. All rights reserved.
//
#import <Foundation/Foundation.h>
@implementation DCTCDGroup (DCTManagedObjectAutomatedSetup)
+ (NSDictionary *)dct_mappingFromRemoteNamesToLocalNames {
NSMutableDictionary *d = [[NSMutableDictionary alloc] init];
[d setObject:@"groupID" forKey:@"id"];
[d setObject:@"groupDescription" forKey:@"description"];
return [d autorelease];
}
+ (id)dct_convertValue:(id)value toCorrectTypeForKey:(NSString *)key {
@implementation DCTCDItem (DCTManagedObjectAutomatedSetup)
+ (NSString *)dct_uniqueKey {
return @"theID";
}
+ (NSDictionary *)dct_mappingFromRemoteNamesToLocalNames {
NSMutableDictionary *d = [[NSMutableDictionary alloc] init];
[d setObject:@"theID" forKey:@"remoteID"];
return [d autorelease];
@danielctull
danielctull / UIView+DCTResizing.h
Created October 21, 2010 10:48
A category to easily resize the frame of a view.
@interface UIView (DCTResizing)
- (void)setWidth:(CGFloat)newWidth;
- (void)setHeight:(CGFloat)newHeight;
@end
[managedObjectContext dct_asynchronousFetchRequest:fetchRequest
withCallbackBlock:^(NSArray *fetchedObjects, NSError *error) {
// Do something with the fetched objects in this callback block.
NSLog(@"fetchedObjects: %@", fetchedObjects);
NSLog(@"error: %@", error);
}];
[managedObjectContext dct_asynchronousObjectsForEntityName:@"DCTCDGroup"
predicate:predicate
sortDescriptors:sortDescriptors
callbackBlock:^(NSArray *fetchedObjects, NSError *error) {
NSLog(@"sorted fetchedObjects: %@", fetchedObjects);
NSLog(@"error: %@", error);
}];
@danielctull
danielctull / git-dctsubmodule
Created December 25, 2010 12:12
An extension to git to allow easy removal of submodules
#!/bin/bash
usage() {
echo "usage: git dctsubmodule remove [--hard] submodulepath"
}
if [[ ! -f .gitmodules ]]; then
echo "git submodules not in use"
exit
fi
@danielctull
danielctull / gitappledoc
Created December 26, 2010 00:08
A script that uses appledoc by tomaz to generate documentation. Default branches are "develop" for the code and "gh-pages" for the documentation branch (to work with github pages to serve the docs).
#!/bin/bash
codebranch="develop"
docbranch="gh-pages"
projectname=$(pwd | sed "s/^.*\///g")
docdirectory="Documentation"
defaultcommitmessage="Update documentation."
# Switches to the codebranch
# Generates the documentation to /tmp/gitappledoc/
# Switches to the docbranch
# bash/zsh completion support for core Git.
#
# Copyright (C) 2006,2007 Shawn O. Pearce <spearce@spearce.org>
# Conceptually based on gitcompletion (http://gitweb.hawaga.org.uk/).
# Distributed under the GNU General Public License, version 2.0.
#
# The contained completion routines provide support for completing:
#
# *) local and remote branch names
# *) local and remote tag names
@danielctull
danielctull / Test.gist
Created April 30, 2011 18:29
Test Gist
Testy Test test.