This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@class GHTestCase; | |
@interface GHTestCase (Swizzle) | |
+ (id)sharedMock; | |
+ (void)setSharedMock:(id)newMock; | |
- (void)swizzle:(Class)target_class selector:(SEL)selector; | |
- (void)deswizzle; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# v 1.0.1 | |
~$ ARCHFLAGS='-arch i386 -arch x86_64' | |
~$ rvm install 1.8.7 --debug --reconfigure -C --enable-shared=yes | |
~$ wget http://sourceforge.net/projects/rubycocoa/files/RubyCocoa/1.0.1/RubyCocoa-1.0.1.tar.gz/download | |
~$ tar xzf RubyCocoa-1.0.1.tar.gz && rm RubyCocoa-1.0.1.tar.gz && cd RubyCocoa-1.0.1 | |
~/RubyCocoa-1.0.1$ ruby install.rb config --build-universal=yes | |
~/RubyCocoa-1.0.1$ ruby install.rb setup | |
~/RubyCocoa-1.0.1$ sudo ruby install.rb install |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RSpec::Matchers.define(:be_same_file_as) do |exected_file_path| | |
match do |actual_file_path| | |
expect(md5_hash(actual_file_path)).to eq(md5_hash(expected_file_path)) | |
end | |
def md5_hash(file_path) | |
Digest::MD5.hexdigest(File.read(file_path)) | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
check process sequoia_dj2_delayed_job_0 | |
with pidfile /home/deploy/rails/sequoia/shared/pids/delayed_job.0.pid | |
start program = "/home/deploy/rails/sequoia/shared/delayed_job_runner.sh start production 0" | |
as uid deploy and gid deploy | |
stop program = "/home/deploy/rails/sequoia/shared/delayed_job_runner.sh stop production 0" | |
as uid deploy and gid deploy | |
check process sequoia_dj2_delayed_job_1 | |
with pidfile /home/deploy/rails/sequoia/shared/pids/delayed_job.1.pid | |
start program = "/home/deploy/rails/sequoia/shared/delayed_job_runner.sh start production 1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Find files recursively in/under the current directory | |
function findin() | |
{ | |
find . -exec grep $@ '{}' \; -print | |
} | |
# Rails 2 and Rails 3 console | |
function rc { | |
if [ -e "./script/console" ]; then | |
./script/console $@ | |
else |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# https://gist.github.com/949831 | |
# http://blog.carbonfive.com/2011/05/04/automated-ad-hoc-builds-using-xcode-4/ | |
# command line OTA distribution references and examples | |
# http://nachbaur.com/blog/how-to-automate-your-iphone-app-builds-with-hudson | |
# http://nachbaur.com/blog/building-ios-apps-for-over-the-air-adhoc-distribution | |
# http://blog.octo.com/en/automating-over-the-air-deployment-for-iphone/ | |
# http://www.neat.io/posts/2010/10/27/automated-ota-ios-app-distribution.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ApplicationController < ActionController::Base | |
... | |
# FORCE to implement content_for in controller | |
def view_context | |
super.tap do |view| | |
(@_content_for || {}).each do |name,content| | |
view.content_for name, content | |
end | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gem 'dragonfly', '~>0.9.4' | |
group :production do | |
gem 'fog' # for Amazon S3 | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NSData *bom = nil; | |
NSStringEncoding encoding = ...; | |
NSData *a = [@"a" dataUsingEncoding:encoding]; | |
NSData *aa = [@"aa" dataUsingEncoding:encoding]; | |
if ([a length] * 2 != [aa length]) { | |
NSUInteger characterLength = [aa length] - [a length]; | |
bom = [a subdataWithRange:NSMakeRange(0, [a length]-characterLength)]; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# hosts-to-vm.sh | |
# | |
# Made for use alongside the excellent ievms - | |
# https://github.com/xdissent/ievms | |
# | |
# Will export the local hosts (from /etc/hosts) | |
# to a batch script & add that batch script to a Windows VM | |
# The batch script will be executed to import the hosts onto the VM | |
# The batch file seems convoluted, until you only want to append the new hosts. |
OlderNewer