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
@lukeredpath
lukeredpath / RestyExamples.m
Created August 3, 2010 18:25
Working on my Ruby restclient-inspired Objective-C REST library
// delegate-based API
[[LRResty client] get:@"http://example.com/testing" delegate:self]; // calls @selector(restClient:receivedResponse:)
// block-based API
[[LRResty client] get:@"http://example.com/testing" withBlock:^(LRRestyResponse *response) {
NSLog(@"Received response with status %d, body: %@", response.status, [response asString]);
}];
class SimpleBuilder
def set(key, value)
@stuff[key] = value
end
def self.build(&block)
new.tap { |builder| builder.instance_eval(&block) }
end
end
class TestClass
def do_something
puts "Doing something"
end
end
module TestModule
def do_something
super
puts "Doing something else"
# this is just a rough example, the actual nested matcher is irrelevant
Spec::Matchers.define :string_containing do |substring|
match do |actual|
actual.include?(substring)
end
end
results = some_array
From 3d40a3907187800559626589aab0b3263e3777ad Mon Sep 17 00:00:00 2001
From: Luke Redpath <[email protected]>
Date: Mon, 23 Aug 2010 19:57:36 +0100
Subject: [PATCH] Runtime checks are required for multi-tasking on iOS3 devices
---
Classes/ASIHTTPRequest/ASIHTTPRequest.m | 13 +++++++++++--
1 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/Classes/ASIHTTPRequest/ASIHTTPRequest.m b/Classes/ASIHTTPRequest/ASIHTTPRequest.m
require 'eventmachine'
require 'json'
require 'mimic'
require 'logger'
module FakeCampfireServer
class Handler
def initialize(ipc)
@ipc = ipc
@ipc.delegate = self
namespace :tag do
desc "Tag last post"
task :last do
system("./_scripts/tagposts last")
end
desc "Re-tag all posts"
task :all do
system("./_scripts/tagposts all")
end
require 'restclient'
require 'json'
module Frank
DEFAULT_PORT = 37265
class Driver
def initialize(client)
@client = client
end
class Foo
has_many :bars
end
class Bar
belongs_to :foo
belongs_to :qux
end
class Qux
@lukeredpath
lukeredpath / Rakefile
Created August 31, 2010 18:16
Rakefile.rb
require 'rake/tasklib'
TARGET_NAME = "libLROAuth2Client"
module XcodeBuild
class TaskBuilder < Rake::TaskLib
attr_accessor :target, :configuration
def initialize(name)
@name = name