Skip to content

Instantly share code, notes, and snippets.

@ssp
ssp / nibtoxib.sh
Created December 11, 2009 11:57
nibtoxib
#! /bin/sh
find . -name "*.nib" -type d | awk '{sub(/.nib/,"");print}' | xargs -I % ibtool --write %.xib --upgrade %.nib
//
// UACellBackgroundView.m
// Ambiance
//
// Created by Matt Coneybeare on 1/31/10.
// Copyright 2010 Urban Apps LLC. All rights reserved.
//
#define TABLE_CELL_BACKGROUND { 1, 1, 1, 1, 0.866, 0.866, 0.866, 1} // #FFFFFF and #DDDDDD
#define kDefaultMargin 10
@lukeredpath
lukeredpath / AssertEventually.h
Created August 3, 2010 13:20
Enables simple and elegant testing of asynchronous/threaded code with OCUnit, blocks and OCHamcrest
//
// AssertEventually.h
// LRResty
//
// Created by Luke Redpath on 03/08/2010.
// Copyright 2010 LJR Software Limited. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "HCMatcher.h"
- (void)login {
// build request
ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:[NSURL URLWithString:url]];
#ifdef MOCK_HANDSHAKE
// create a nice mock
request = [OCMockObject niceMockForClass:[ASIHTTPRequest class]];
NSString *modelPath = [[NSBundle mainBundle] pathForResource:@"mock_handshake" ofType:@"txt"];
NSString *responseString = [NSString stringWithContentsOfFile:modelPath encoding:NSUTF8StringEncoding error:nil];
[[[(id)request stub] andReturn:responseString] responseString];
@jpwatts
jpwatts / xcode-git-version.sh
Created May 11, 2011 16:42
This Xcode 4 build phase script automatically sets the version and short version string of an application bundle based on information from the containing Git repository.
#!/bin/bash
# This script automatically sets the version and short version string of
# an Xcode project from the Git repository containing the project.
#
# To use this script in Xcode 4, add the contents to a "Run Script" build
# phase for your application target.
set -o errexit
set -o nounset
@shazron
shazron / sim-run.sh
Created October 25, 2011 21:53
Run Xcode Simulator project from the command line
#!/bin/bash
#
# Build and iPhone Simulator Helper Script
# Shazron Abdullah 2011
#
# WARN: - if your .xcodeproj name is not the same as your .app name,
# this won't work without modifications
# - you must run this script in where your .xcodeproj file is
PROJECTNAME=$1
@davidnunez
davidnunez / gist:1404789
Created November 29, 2011 13:20
list all installed packages in android adb shell
pm list packages -f
@danielphillips
danielphillips / DJPAppDelegate.h
Created February 8, 2012 22:11
Create a solid colour (no Apple gloss) UINavigationBar
@interface DJPAppDelegate : UIResponder <UIApplicationDelegate, UIAppearanceContainer>
@end
@jdewind
jdewind / convert.rb
Created February 24, 2012 21:53
OCMock to Kiwi
files = [ARGV[0] || Dir["*.m"]].flatten
files.each do |file|
content = File.read(file)
mapped_content = content.lines.map do |line|
[
{from: /\[\[\[(.+) (?:stub|expect)\] andReturn:(.+)\] (.+)/, to: "[[%s stubAndReturn:%s] %s"},
{from: /\[\[\[(.+) (?:stub|expect)\] andReturn\w+:(.+)\] (.+)/, to: "[[%s stubAndReturn:theValue(%s)] %s"},
{from: /\[(?:\(\w+\s*\*\)){,1}\[(.+) expect\] (.+)/, to: "[[[%s should] receive] %s"},
{from: /\[OCMockObject observerMock\]/, to: "[Kiwi observerMock]"},
@barraponto
barraponto / git-submodule-rm.sh
Created April 25, 2012 16:36
git submodule-rm
#!/bin/bash
function actual_path() {
if [ [ -z "$1" ] -a [ -d $1 ] ]; then
echo $(cd $1 && test `pwd` = `pwd -P`)
return 0
else
return 1
fi
}