Skip to content

Instantly share code, notes, and snippets.

@rudyjahchan
rudyjahchan / Rakefile
Created June 9, 2011 16:45
Building and Deploying iOS Projects through Rake
require 'yaml'
require 'uri'
require 'tempfile'
require 'tmpdir'
SDK_DIR = "/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.3.sdk"
TESTFLIGHT_URL = 'http://testflightapp.com/api/builds.json'
PROJECT_DIR = File.dirname __FILE__
RUBIOS_DIR = File.join(PROJECT_DIR, 'rubios')
@rudyjahchan
rudyjahchan / Frank.feature
Created July 18, 2011 22:45
Samples of Test Code in various frameworks
Feature: Demonstrating the touchx:y: api
Background:
Given I launch the app
Scenario: Add test user
# about where "Larry Stooge" row should be in main screen
When I touch the screen at (80,90)
Then I wait to see a navigation bar titled "User Profile"
And I should see "Larry"
@rudyjahchan
rudyjahchan / BadCode.m
Created July 19, 2011 20:26
A desire to have factories
__block SignInController* _signInController;
__block UITextField* _emailTextField;
__block UITextField* _passwordTextField;
__block UIGradientButton* _signInButton;
__block UIView* _signingInView;
__block UILabel* _signedInLabel;
beforeEach(^{
_signInController = [[SignInController new] autorelease];
_emailTextField = [[UITextField new] autorelease];
@rudyjahchan
rudyjahchan / AClassACategoryImplementation.h
Created January 23, 2012 02:42
Monkey-Patching iOS with Objective-C Categories Part I: Simple Extensions and Overrides
#import <Foundation/Foundation.h>
@interface AClass (ACategory)
@end
@rudyjahchan
rudyjahchan / MyClassWithFakePrivateProperties.m
Created March 25, 2012 05:55
Monkey-Patching iOS with Objective-C Categories Part II: Adding Properties
#import "MyClassWithFakePrivateProperties.h"
@interface MyClassWithFakePrivateProperties ()
@property (nonatomic, strong) NSString *foo;
@end
@implementation MyClassWithFakePrivateProperties
@rudyjahchan
rudyjahchan / NSObject_Swizzle.h
Last active August 13, 2016 08:29
Monkey-Patching iOS with Objective-C Categories Part III: Swizzling
#import <Foundation/Foundation.h>
@interface NSObject (Swizzle)
+ (void)swizzleInstanceSelector:(SEL)originalSelector
withNewSelector:(SEL)newSelector;
@end
@rudyjahchan
rudyjahchan / PostResource.java
Created March 25, 2012 06:50
DRY RESTful Resources with Java Generics
package myapp.resource;
import com.google.inject.ImplementedBy;
import myapp.Post;
@ImplementedBy(PostResourceImpl.class)
public interface PostResource extends Resource<Post> {
}
@rudyjahchan
rudyjahchan / style.css
Created August 11, 2012 08:10
Create Victorian Style Curly braced block
#station-ident {
padding: 10px;
margin: 10px 30px;
text-align: justify;
line-height: 26px;
font-size: 18px;
font-family: palatino, "times new roman", serif;
font-style: italic;
}
@rudyjahchan
rudyjahchan / gist:3350546
Created August 14, 2012 16:09
Run a screensaver as a desktop background
tell application "System Events"
if process "ScreenSaverEngine" exists then
tell application "ScreenSaverEngine" to quit
else
do shell script "/System/Library/Frameworks/ScreenSaver.framework/Resources/ScreenSaverEngine.app/Contents/MacOS/ScreenSaverEngine -background > /dev/null 2>&1 &"
end if
end tell
@rudyjahchan
rudyjahchan / 01.getting.windows.js
Created August 17, 2012 05:50
Cross-Domain Browser Communication with HTML5 Window#postMessage; only loading windows if they don't already exist
// getting the window of an iframe
receiver = document.getElementById('frameId').contentWindow;
// opening a named window to another application
receiver = window.open('http://anotherdomain.dev/path', 'myPopup');
// getting a named window WITHOUT loading any content
receiver = window.open(null, 'myPopup');