Skip to content

Instantly share code, notes, and snippets.

View lukeredpath's full-sized avatar
🏠
Working from home

Luke Redpath lukeredpath

🏠
Working from home
View GitHub Profile
class Array
def rotate(number_of_times = 1)
returning(self) do
number_of_times.times { unshift(pop) }
end
end
end
# why would you use this?
#
class ActiveSupport::TestCase
# your test helpers here...
define_webrat_filters do
before_request "/home", :stub_blog_feed!
before_request /about/, :stub_blog_feed!
end
end
ActionController::IntegrationTest.class_eval do
# override webrat's visit method to handle rack redirects
# see http://is.gd/aM89F for more information about this
def visit(*args)
super(*args)
if rack_middleware_has_redirected?
visit @integration_session.headers["Location"]
end
end
#import "CoreDataDemoAppDelegate.h"
#import "CoreDataManager.h"
@implementation CoreDataDemoAppDelegate
@synthesize window;
#pragma mark -
#pragma mark Application lifecycle
// fetch all playlist tracks
playlists tracks 0 100000 tags:dtuaJlxKoBN playlist_id:10886 sort:tracknum
// response:
{
id = 1;
method = "slim.request";
params = (
"",
(
require 'nokogiri'
require 'mash'
module CoopBanking
class Statement
COLUMNS = [:date, :description, :credit, :debit, :balance]
attr_reader :transactions
def initialize(transactions)
@lukeredpath
lukeredpath / NSArray+Indexing.h
Created April 22, 2010 15:55
A small NSArray category for producing indexed arrays of objects for use with UITableView sections
//
// NSArray+Indexing.h
// TellYouGov
//
// Created by James Adam on 16/02/2010.
// Copyright 2010 Lazyatom Limited. All rights reserved.
//
#import <UIKit/UIKit.h>
@lukeredpath
lukeredpath / LRTableViewCollection.h
Created April 22, 2010 16:46
A handy collection class for use with UITableView data sources, with filtering and indexing support baked in.
//
// LRTableViewCollection.h
// TellYouGov
//
// Created by Luke Redpath on 19/04/2010.
// Copyright 2010 LJR Software Limited. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface UIViewController (NibCells)
- (UITableViewCell *)loadTableViewCellFromNibNamed:(NSString *)nibName;
- (UITableViewCell *)loadReusableTableViewCellFromNibNamed:(NSString *)nibName;
@end
A great starting point for Objective-C and Cocoa in general:
Cocoa Programming for Mac OSX by Aaron Hillegaas
http://www.amazon.co.uk/Cocoa-Programming-Mac-OS-X/dp/0321503619/ref=sr_1_13?ie=UTF8&s=books&qid=1273592608&sr=8-13
Not read it, but considered *the* guide to Objective-C:
Programming in Objective-C by Stephen Kochan
http://www.amazon.co.uk/Programming-Objective-C-2-0-Developers-Library/dp/0321566157/ref=sr_1_1?ie=UTF8&s=books&qid=1273592595&sr=8-1