Skip to content

Instantly share code, notes, and snippets.

View anthonyherron's full-sized avatar

Anthony Herron anthonyherron

View GitHub Profile
@anthonyherron
anthonyherron / ThreeFinderGesturesBackInXcode.txt
Created August 8, 2011 15:53
Enable 3 finger swipe to switch between .h & .m in Xcode
Three finger gestures are awesome in Xcode, but they disappeared in Lion :(
You can bring them back to life however...
Inspired by a post from @gordonhughes (http://geeksinkilts.com/?p=67), explaining how to bring them back on an external trackpad, I started digging around for a way to get it working on the internal trackpads for the mbp/mba models.
*edit*
Perhaps an easier way of doing this found by @gordonhughes again is just this 1 line in Terminal, haven't confirmed this yet though
defaults -currentHost write -g "com.apple.trackpad.threeFingerVertSwipeGesture" -int 1
@anthonyherron
anthonyherron / gist:1276141
Created October 10, 2011 18:43
Subclass UILabel and add below to start drawing text at exactly origin 0.0,0.0 (x,y)
-(void) drawTextInRect:(CGRect)inFrame
{
CGRect draw = [self textRectForBounds:inFrame limitedToNumberOfLines:[self numberOfLines]];
draw.origin = CGPointZero;
[super drawTextInRect:draw];
}
@anthonyherron
anthonyherron / gist:1312852
Created October 25, 2011 14:09
Gist for Faizan
-(void)setupPlayer
{
// adds the player to the view, player is an instance of MPMoviePlayerController
player = [[MPMoviePlayerController alloc] initWithContentURL:[NSURL URLWithString:@"http://qthttp.apple.com.edgesuite.net/11ajdjnvkjnd10weoihf23ohfoihqw/sl_mvp.m3u8"]];
// loads the movie with the above URL
player.view.frame = self.bounds;
player.view.userInteractionEnabled = YES;
[self addSubview:self.player.view];
[self.player prepareToPlay];
- (void)drawRect:(CGRect)rect
{
// Drawing code
CGContextRef context = UIGraphicsGetCurrentContext();
CGRect rectForBezierPath = CGRectMake(100.0, 100.0, 100.0, 100.0);
UIBezierPath *path = [UIBezierPath bezierPathWithRoundedRect:rectForBezierPath byRoundingCorners:UIRectCornerAllCorners cornerRadii:CGSizeMake(8.0, 8.0)];
[[UIColor whiteColor] setFill];
[path fill];
@anthonyherron
anthonyherron / @fablednet
Created January 25, 2012 20:59
For @fablednet - simple audio playing
@implementation ViewController
@synthesize player = _player;
-(IBAction)playSound
{
if (![_player isPlaying]) {
[_player play];
}
}
@anthonyherron
anthonyherron / UILabelStrikethrough.h
Created September 9, 2012 21:48 — forked from mikaelbartlett/UILabelStrikethrough.h
Simple class for IOS SDK UILabel with strikethrough
@interface UILabelStrikethrough : UILabel {
int xOffset;
int yOffset;
int widthOffset;
int stroke;
UIColor* strokeColor;
}
@property (nonatomic) int xOffset;
@property (nonatomic) int yOffset;
@property (nonatomic) int widthOffset;
@interface NSNumber (Enumeration)
- (void)times:(void (^)(NSUInteger index, BOOL *stop))block;
@end