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
#import <Foundation/Foundation.h> | |
enum { | |
LXMonday = 1 << 0, | |
LXTuesday = 1 << 1, | |
LXWednesday = 1 << 2, | |
LXThursday = 1 << 3, | |
LXFriday = 1 << 4, | |
LXSaturday = 1 << 5, | |
LXSunday = 1 << 6, |
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
typedef void (^LXSResumeBlock)(void); | |
typedef void (^LXSRunLoopBlock)(LXSResumeBlock resume); | |
// Call resume() to stop the block from exercising the run loop and break out of the loop/block. | |
// Failure to call resume() will cause the test to hang indefinitely. | |
// This is useful to testing asynchronous actions like AFNetworking operations. See https://gist.github.com/2215212 | |
// With some reference from https://github.com/icanzilb/MTTestSemaphore, I was able to simplify this method. | |
inline void LXS_exercisesRunLoopInBlock(LXSRunLoopBlock block) { | |
__block BOOL keepRunning = YES; | |
block(^{ keepRunning = NO; }); | |
while (keepRunning && [[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.03]]) { |
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
- (IRGeoInterceptor *)interceptorWithDelegate:(id<MKMapViewDelegate>)theDelegate { | |
if (_interceptor == nil) { | |
_interceptor = [[IRGeoInterceptor alloc] init]; | |
_interceptor.middleMan = self; | |
_interceptor.receiver = theDelegate; | |
[super setDelegate:(id<MKMapViewDelegate>)_interceptor]; | |
} | |
return _interceptor; |
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
#import "ProxyView.h" | |
@implementation ProxyView | |
@synthesize targetView = _targetView; | |
- (UIView *)hitTest:(CGPoint)thePoint withEvent:(UIEvent *)theEvent { | |
return [self.targetView hitTest:thePoint withEvent:theEvent]; | |
} |
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
# The decoded `purchase-info` from `SKPaymentTransaction`: | |
{ | |
bid = "com.example.app"; | |
bvrs = 7; | |
"item-id" = 580191698; | |
"original-purchase-date" = "2012-11-27 15:26:42 Etc/GMT"; | |
"original-purchase-date-ms" = 1354030002000; | |
"original-purchase-date-pst" = "2012-11-27 07:26:42 America/Los_Angeles"; | |
"original-transaction-id" = 1000000059318468; |
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
{ | |
"signature" = "AkYuPMDg5n9y40Q/jWOO/UNJyFAo3cO+oRjIZIKYt7/M05EyXqJNHJGPQnmda4Zy0BqGsz1m2fpSJQatT03V/b0TfAr4+p8bofURjCLY9NX36LCgWDjwS1SxRao+4ek72q53MeGVSkGoy5E27jSz5P2fQds8PvwPid3Dx3O594/wAAADVzCCA1MwggI7oAMCAQICCGUUkU3ZWAS1MA0GCSqGSIb3DQEBBQUAMH8xCzAJBgNVBAYTAlVTMRMwEQYDVQQKDApBcHBsZSBJbmMuMSYwJAYDVQQLDB1BcHBsZSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTEzMDEGA1UEAwwqQXBwbGUgaVR1bmVzIFN0b3JlIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTA5MDYxNTIyMDU1NloXDTE0MDYxNDIyMDU1NlowZDEjMCEGA1UEAwwaUHVyY2hhc2VSZWNlaXB0Q2VydGlmaWNhdGUxGzAZBgNVBAsMEkFwcGxlIGlUdW5lcyBTdG9yZTETMBEGA1UECgwKQXBwbGUgSW5jLjELMAkGA1UEBhMCVVMwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAMrRjF2ct4IrSdiTChaI0g8pwv/cmHs8p/RwV/rt/91XKVhNl4XIBimKjQQNfgHsDs6yju++DrKJE7uKsphMddKYfFE5rGXsAdBEjBwRIxexTevx3HLEFGAt1moKx509dhxtiIdDgJv2YaVs49B0uJvNdy6SMqNNLHsDLzDS9oZHAgMBAAGjcjBwMAwGA1UdEwEB/wQCMAAwHwYDVR0jBBgwFoAUNh3o4p2C0gEYtTJrDtdDC5FYQzowDgYDVR0PAQH/BAQDAgeAMB0GA1UdDgQWBBSpg4PyGUjFPhJXCBTMzaN+mV8k9TAQBgoqhkiG92NkBgUBBAIFADANBgkqhkiG9w0BAQUFAAOCAQEAEaSbPjtmN4C/IB3QEpK32RxacCDXdV |
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
{ | |
"status": 21006, | |
"receipt": { | |
"original_purchase_date_ms": "1335927991000", | |
"original_purchase_date_pst": "2012-05-01 20:06:31 America\/Los_Angeles", | |
"transaction_id": "1000000060958597", | |
"quantity": "1", | |
"bid": "kh.com.ctn.plus", | |
"original_transaction_id": "1000000046496076", | |
"unique_vendor_identifier": "1E8A3A6A-F455-4020-8194-7BC14991A00A", |
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
# Copyright (c) 2013 Stan Chang Khin Boon (http://lxcid.com/) | |
# | |
# Permission is hereby granted, free of charge, to any person obtaining a copy | |
# of this software and associated documentation files (the "Software"), to deal | |
# in the Software without restriction, including without limitation the rights | |
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
# copies of the Software, and to permit persons to whom the Software is | |
# furnished to do so, subject to the following conditions: | |
# | |
# The above copyright notice and this permission notice shall be included in |
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
# Base on http://stackoverflow.com/a/12839484/379604 and https://github.com/capistrano/capistrano/blob/master/lib/capistrano/recipes/deploy/assets.rb | |
namespace :deploy do | |
namespace :assets do | |
desc <<-DESC | |
Run the asset precompilation rake task locally. You can specify the \ | |
full path to the rake executable by setting the rake variable. You \ | |
can also specify additional environment variables to pass to rake via \ | |
the asset_env variable. The defaults are: | |
set :rake, "rake" |
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
- (void)modifySelectedString: (NSDictionary *)theAttribute { | |
NSString *mainString = [self.mainStringLabel.attributedText string]; | |
NSString *queryString = [self selectStringFromMainStringLabelViaStepper]; | |
NSRange selectedStringRange = NSMakeRange(0, mainString.length); | |
while (selectedStringRange.location != NSNotFound) { | |
NSRange selectedStringRange = [mainString rangeOfString:queryString options:0 range:selectedStringRange]; | |
if (selectedStringRange.location != NSNotFound) { | |
[self addAttributeWithRangeToSelectedString:theAttribute range:selectedStringRange]; |
OlderNewer