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> | |
#define JADictionaryOfVariableBindings(...) \ | |
[NSDictionary dictionaryWithObjects:(const id []){ __VA_ARGS__ } \ | |
forKeys:(const NSString *[]){ JATEMPLATE_MAP(JATEMPLATE_NAME_FROM_ARG, __VA_ARGS__) } \ | |
count:JATEMPLATE_ARGUMENT_COUNT(__VA_ARGS__)] | |
#define JATEMPLATE_NAME_FROM_ARG(ITEM) @#ITEM | |
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
static OSStatus | |
SSLVerifySignedServerKeyExchange(SSLContext *ctx, bool isRsa, SSLBuffer signedParams, | |
uint8_t *signature, UInt16 signatureLen) | |
{ | |
SSLBuffer hashCtx; | |
hashCtx.date = 0; | |
OSStatus err = SSLVerifySignedServerKeyExchangeInner(ctx, isRsa, signedParams, signature, signatureLen, &hashCtx); | |
SSLFreeBuffer(hashCtx); |
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> | |
#import <objc/runtime.h> | |
@interface Test: NSObject | |
@end | |
@interface Test (Dynamic) | |
- (void)foo:(float)x :(float)y; |
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
// Expansion of JATExpandLiteral(@"foo: {foo}; bar: {bar}; baz: {baz}", foo, bar, baz) | |
JAT_DoExpandTemplateUsingMacroKeysAndValues(@"foo: {foo}; bar: {bar}; baz: {baz}", (JATNameArray){ @"foo", @"bar", @"baz", ((void*)0) }, (JATParameterArray){ JATCastParameter(foo), JATCastParameter(bar), JATCastParameter(baz), ((void*)0) }, 3) |
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
#undef MIN | |
#define MIN__(A,B,C) ({ __typeof__(A) __a##C = (A); __typeof__(B) __b##C = (B); __a##C < __b##C ? __a##C : __b##C; }) | |
#define MIN_(A,B,C) MIN__(A,B,C) | |
#define MIN(A,B) MIN_(A,B,__COUNTER__) | |
#undef MAX | |
#define MAX__(A,B,C) ({ __typeof__(A) __a##C = (A); __typeof__(B) __b##C = (B); __a##C < __b##C ? __b##C : __a##C; }) | |
#define MAX_(A,B,C) MAX__(A,B,C) | |
#define MAX(A,B) MAX_(A,B,__COUNTER__) |
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
@implementation Foo | |
- (id) foo | |
{ | |
return [self bar]; | |
} | |
- (id) bar | |
{ |
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) 2011 Jens Ayton | |
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 all copies or substantial portions of the Software. | |
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE |
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 desired output of each test case is: | |
<MyException 0xPTR>{ TestName, retain count 1 } created. | |
<MyException 0xPTR>{ TestName, retain count 1 } caught. | |
<MyException 0xPTR>{ TestName, retain count 1 } dealloced. | |
For a fun time, try to predict the actual output for all six test cases! | |
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
// There are exact equivalents for CoreFoundation, if you like typing CFRelease a lot. | |
NSString *path = [[NSBundle mainBundle] builtInPlugInsPath]; // Or privateFrameworksPath, or some other thing. | |
path = [path stringByAppendingPathComponent:@"foo.dylib"]; | |
void *handle = dlopen([path fileSystemRepresentation], flags); |
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
#!/usr/bin/python | |
# Nicolas Seriot | |
# 2011-01-06 | |
# http://github.com/nst/objc_dep | |
""" | |
Input: path of an Objective-C project | |
Output: import dependancies Graphviz format |