Skip to content

Instantly share code, notes, and snippets.

Avatar
👋
Hiring! See my profile for details.

Simon Whitaker simonwhitaker

👋
Hiring! See my profile for details.
View GitHub Profile
@simonwhitaker
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-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
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
GS_INFO_PLIST_INPUT=$(basename "$INFOPLIST_FILE" .plist)
# Get location of parsed Info.plist
GS_INFO_PLIST_PATH="$BUILT_PRODUCTS_DIR/$FULL_PRODUCT_NAME/Info"
# 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
simonwhitaker / index.yaml
Created Oct 20, 2010
nanoc config for the Goo Software website homepage
View index.yaml
apps:
- name: RSA Vision
slogan: Enlightenment to go
itunes_url: http://itunes.apple.com/gb/app/rsa-vision/id397348011?mt=8
image: /images/apps/rsa-vision.png
description:
- > 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
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(' ','-') %>">
<h2>
<a href="<%= app[:itunes_link] %>"><%= app[:name] %></a>
<span class="appslogan"><%= app[:slogan]%></span>
</h2>
<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
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
#!/bin/bash
# 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)
echo
@simonwhitaker
simonwhitaker / pymod.sh
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.
View pymod.sh
# 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
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
simonwhitaker / gist:1493422
Created Dec 18, 2011
Diffs between TBXML as downloaded from tbxml.co.uk and the initial commit on https://github.com/steipete/TBXML/
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
258c258
< while (elementStart = strstr(elementStart,"<")) {
---
> while ((elementStart = strstr(elementStart,"<"))) {
311c311
< while (elementEnd = strpbrk(elementEnd, "<>")) {
---