Skip to content

Instantly share code, notes, and snippets.

Hiring! See my profile for details.

Simon Whitaker simonwhitaker

Hiring! See my profile for details.
View GitHub Profile
simonwhitaker / show-constants.m
Created Apr 5, 2010
A simple Objective-C program to show the control point values for the constants in the CAMediaTimingFunction class
View show-constants.m
Show the control point values for the CAMediaTimingFunction class constants
To compile:
clang -framework QuartzCore -framework Foundation show-constants.m -o show-constants
simonwhitaker / gist:506429
Created Aug 3, 2010
Append the current SVN revision to an iPhone app's version number at build time
View gist:506429
# Get location of unparsed Info.plist
# Get location of parsed Info.plist
# Get version number from unparsed Info.plist
GS_VERSION=$(defaults read "$PROJECT_DIR/$GS_INFO_PLIST_INPUT" CFBundleVersion)
# Append local SVN revision number
View gist:546623
- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation
if (UIInterfaceOrientationIsLandscape(fromInterfaceOrientation)) {
// Fade in instructions
[self setInstructionsOpacity:1.0 overTime:0.5];
simonwhitaker / index.yaml
Created Oct 20, 2010
nanoc config for the Goo Software website homepage
View index.yaml
- name: RSA Vision
slogan: Enlightenment to go
image: /images/apps/rsa-vision.png
- > The RSA Vision app brings to you the latest videos from the
RSA's free public events programme. You can browse by category,
search for videos and compile a playlist of your favourite
videos to watch later.
simonwhitaker / index.rhtml
Created Oct 20, 2010
RHTML snippet showing use of nanoc to construct config-driven website for Goo Software Ltd
View index.rhtml
<% for app in @item[:apps]%>
<div class="app" id="<%= app[:name].downcase.gsub(' ','-') %>">
<a href="<%= app[:itunes_link] %>"><%= app[:name] %></a>
<span class="appslogan"><%= app[:slogan]%></span>
<a href="<%= app[:itunes_link] %>"><img src="<%= app[:image] %>" class="screenshot" alt="app screenshot" border="0"></a>
<div class="description">
<% for desc in app[:description]%>
<p><%= desc %></p>
simonwhitaker / gist:784652
Created Jan 18, 2011
Example of a simple Objective-C-compatible file that won't run under CMD+R in TextMate
View gist:784652
#import <Foundation/Foundation.h>
int main (int argc, char const *argv[])
NSAutoreleasePool *arp = [[NSAutoreleasePool alloc] init];
for(size_t i = 0; i < 2; ++i)
NSLog(@"Hello world");
View git-review
# A simple shell script for helping you do code reviews on patch files. Feed
# in the SHA1 for the commit the patch builds on and the path to the patch
# file and it'll spin up a new branch for you, check it out and apply the
# patch. You can now use your favourite diff tool to review the patch.
usage() {
printf "usage: %s <sha> <patchfile>\n" $(basename $0)
simonwhitaker /
Created May 18, 2011
pymod - Python one-liner for finding the location on disk of a given Python module. Stick it in your .bashrc or whatever for instant pymod joy.
# pymod MOD: find file path to implementation for python module called MOD
alias pymod="python -c 'import sys; print(__import__(sys.argv[1]).__file__)'"
simonwhitaker / UIColor+GSAdditions.h
Created Sep 15, 2011
A category on UIColor adding +(UIColor*)colorWithHexValue:(NSString*)hexValue;
View UIColor+GSAdditions.h
// UIColor+GSAdditions.h
// Created by Simon Whitaker at Goo Software Ltd on 15/09/2011.
#import <UIKit/UIKit.h>
@interface UIColor (GSAdditions)
simonwhitaker / gist:1493422
Created Dec 18, 2011
Diffs between TBXML as downloaded from and the initial commit on
View gist:1493422
$ diff -r TBXML-orig/ TBXML-github-fc2db6c/
Only in TBXML-github-fc2db6c/: .git
diff -r TBXML-orig/TBXML.m TBXML-github-fc2db6c/TBXML.m
< while (elementStart = strstr(elementStart,"<")) {
> while ((elementStart = strstr(elementStart,"<"))) {
< while (elementEnd = strpbrk(elementEnd, "<>")) {