Skip to content

Instantly share code, notes, and snippets.

View simonwhitaker's full-sized avatar

Simon Whitaker simonwhitaker

  • Oxfordshire, UK
View GitHub Profile
@simonwhitaker
simonwhitaker / version.sh
Created February 26, 2012 19:52 — forked from osteslag/version.sh
Script for managing build and version numbers using git and agvtool. See link in comments below.
#!/bin/sh
# Script for managing build and version numbers using git and agvtool.
# Change log:
# v1.0 18-Jul-11 First public release.
version() {
echo "version.sh 1.0 by Joachim Bondo <[email protected]> http://osteslag.tumblr.com"
}
@simonwhitaker
simonwhitaker / git-version.sh
Created February 8, 2012 16:37
A shell script for setting the CFBundleVersion of an Xcode build based on the current git revision
# A script for generating pseudo-version numbers for a git repository
# and updating the BundleVersion of an Xcode app build with this version
alias git=$(which git)
git_version()
{
# The cornerstone of this hack is "git describe", which
# relies on there being at least one "real" tag (i.e. not
# a lightweight tag) somewhere in the current code's commit
@simonwhitaker
simonwhitaker / save-dated-pdf.sh
Created February 2, 2012 08:37
A PDF Action menu item for OS X that saves to a folder hierarchy incorporating the current date
#!/bin/bash
#
# save-dated-pdf.sh
#
# Save PDFs from the OS X PDF menu to a folder
# named according to the current date, of the
# form /path/YYYY/MM/
#
# For example, you could use this to export receipts
# you receive via email during February 2012 to
@simonwhitaker
simonwhitaker / gist:1493422
Created December 18, 2011 13:29
Diffs between TBXML as downloaded from tbxml.co.uk and the initial commit on https://github.com/steipete/TBXML/
$ 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, "<>")) {
---
@simonwhitaker
simonwhitaker / UIColor+GSAdditions.h
Created September 15, 2011 11:19
A category on UIColor adding +(UIColor*)colorWithHexValue:(NSString*)hexValue;
//
//
// UIColor+GSAdditions.h
//
// Created by Simon Whitaker at Goo Software Ltd on 15/09/2011.
//
#import <UIKit/UIKit.h>
@interface UIColor (GSAdditions)
@simonwhitaker
simonwhitaker / pymod.sh
Created May 18, 2011 20:32
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__)'"
#!/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 / gist:784652
Created January 18, 2011 16:09
Example of a simple Objective-C-compatible file that won't run under CMD+R in TextMate
#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");
}
@simonwhitaker
simonwhitaker / index.rhtml
Created October 20, 2010 12:29
RHTML snippet showing use of nanoc to construct config-driven website for Goo Software Ltd
<% 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 / index.yaml
Created October 20, 2010 12:26
nanoc config for the Goo Software website homepage
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.