Skip to content

Instantly share code, notes, and snippets.

Avatar

Enigmatic Ape enigmaticape

View GitHub Profile
View action_TestSummaries.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>FormatVersion</key>
<string>1.2</string>
<key>RunDestination</key>
<dict>
<key>Name</key>
<string>iPhone Retina (4-inch)</string>
View OCMockBlockTests.m
#import <XCTest/XCTest.h>
#import <OCMock/OCMock.h>
typedef void(^MockBlock)(void);
@interface Action : NSObject
@property (nonatomic, strong) MockBlock action;
@end
@enigmaticape
enigmaticape / SKRequest+Blocks.h
Last active Aug 29, 2015
Adding block based interface to Store Kit SKRequest
View SKRequest+Blocks.h
#import <StoreKit/StoreKit.h>
typedef void(^SKRequestCompletion)(SKRequest * request, NSError * error);
@interface SKRequest (Blocks) <SKRequestDelegate>
- (void) startWithCompletion:(SKRequestCompletion) completion;
@end
View SKRequest+Blocks.m
#import "SKRequest+Blocks.h"
#import <objc/runtime.h>
static char const * const completion_key = "completion";
@implementation SKRequest (Blocks)
- (void)
request :(SKRequest *) request
didFailWithError:(NSError *) error
@enigmaticape
enigmaticape / SKRequest+Blocks.example
Created May 20, 2014
Example of using SKRequest+Blocks
View SKRequest+Blocks.example
SKRequest * arequest = (
[[SKReceiptRefreshRequest alloc]
initWithReceiptProperties:nil
]
);
[arequest
startWithCompletion:^(SKRequest *request, NSError *error)
{
if( error ) {
View onewierdtrick-wi-fi.off
Name : lo0, sa_family : 18
Name : lo0, sa_family : 30
Name : lo0, sa_family : 2
Name : lo0, sa_family : 30
Name : pdp_ip0, sa_family : 18
Name : pdp_ip0, sa_family : 2
Name : en0, sa_family : 18
Name : awdl0, sa_family : 18
View oneweirdtrick-wi-fi.on.not.connected
Name : lo0, sa_family : 18
Name : lo0, sa_family : 30
Name : lo0, sa_family : 2
Name : lo0, sa_family : 30
Name : pdp_ip0, sa_family : 18
Name : pdp_ip0, sa_family : 2
Name : en0, sa_family : 18
Name : awdl0, sa_family : 18
Name : awdl0, sa_family : 30
View oneweirdtrick-wi-fi.on.connected
Name : lo0, sa_family : 18
Name : lo0, sa_family : 30
Name : lo0, sa_family : 2
Name : lo0, sa_family : 30
Name : pdp_ip0, sa_family : 18
Name : pdp_ip0, sa_family : 2
Name : en0, sa_family : 18
Name : en0, sa_family : 30
Name : en0, sa_family : 2
Name : awdl0, sa_family : 18
@enigmaticape
enigmaticape / oneweirdtrick.c
Created May 21, 2014
Determine if Wi-Fi is enabled on iOS with this one weird trick.
View oneweirdtrick.c
struct ifaddrs *interfaces;
if(!getifaddrs(&interfaces)) {
for( struct ifaddrs *interface = interfaces; interface; interface=interface->ifa_next) {
BOOL up = (interface->ifa_flags & IFF_UP) == IFF_UP;
if ( up ) {
NSLog(
@"Name : %s, sa_family : %d",
interface->ifa_name,
interface->ifa_addr->sa_family
View gist:3b8426bed90a9735740f
{
environment = Sandbox;
receipt = {
"adam_id" = 0;
"application_version" = "1.2";
"bundle_id" = "com.enigmaticape.Phoreal";
"download_id" = 0;
"in_app" = (
);
"original_application_version" = "1.0";
You can’t perform that action at this time.