Skip to content

Instantly share code, notes, and snippets.

View chrismcclelland's full-sized avatar

Chris McClelland chrismcclelland

View GitHub Profile
# requires curb gem (http://curb.rubyforge.org/)
# I used matthooks’ vimeo gem to get the required token, sig and ticket. http://github.com/matthooks/vimeo/tree/master
# (flickraw has an alternative method of doing a http POST in the source using net/http which could be adapted for vimeo, avoiding the use of this curb gem)
# connect to Vimeo
VIMEO_API_KEY = "your api key"
VIMEO_SHARED_SECRET = "your shared secret"
// Brute Force, to tidy
- (void)drawRect:(CGRect)rect {
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetLineWidth(context, strokeWidth);
CGContextSetStrokeColorWithColor(context, self.strokeColor.CGColor);
CGRect rrect = self.bounds;
// example demoed at #xcake belfast showing how to use CAGradientLayer to create a gradient button
CAGradientLayer * gradientLayer = [CAGradientLayer layer];
gradientLayer.cornerRadius = 10;
gradientLayer.frame = loginButton.bounds;
gradientLayer.startPoint = CGPointMake(0, 0);
gradientLayer.endPoint = CGPointMake(1.0, 1.0);
gradientLayer.colors = [NSArray arrayWithObjects:(id)[UIColor colorWithWhite:0.90 alpha:1.0].CGColor, [UIColor colorWithWhite:0.5 alpha:1.0].CGColor, nil];
[loginButton.layer insertSublayer:gradientLayer atIndex:0];
Default Fonts in the iPhone SDK
--------------
Family name: AppleGothic
Font name: AppleGothic
Family name: Hiragino Kaku Gothic ProN
Font name: HiraKakuProN-W6
Font name: HiraKakuProN-W3
Family name: Arial Unicode MS
@chrismcclelland
chrismcclelland / UIView Blur Fix
Created January 23, 2010 18:20
UIView blur fix when using: view.center = CGPointmake(x, y)
// UIView blur fix when using: view.center = CGPointmake(x, y)
// reason this happens is because of floating point points on x, y
// drop this into a UIView subclass
-(void)setCenter:(CGPoint)point {
super.center = point;
CGRect newFrame = self.frame;
@chrismcclelland
chrismcclelland / App_Prefix.pch
Created December 16, 2010 00:07
Example Constants File Used in Objective-C Projects
// To globally have these in App.
// Add Constants.h to .pch file like so
#ifdef __OBJC__
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import "Constants.h"
#endif
@chrismcclelland
chrismcclelland / tableView.m
Created January 4, 2011 21:31
Overriding a UITableViewController's TableView
// [Pseudo Code] Overriding a UITableViewController's TableView - viewDidLoad
self.tableView = nil;
UIView *newView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 320)];
newView.backgroundColor = [UIColor clearColor];
self.view = newView;
[newView release];