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 | |
## tmbo.sh -- my attempt at posting from the command line | |
## tmbo: lnk, twitter: @oogali | |
## | |
BASE_URL=thismight.be/offensive | |
TMBO_CONFIG=${HOME}/.tmbo | |
TMPPATH=/tmp | |
usage() { | |
echo "$0 <options> <image to upload> [filename]" |
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
#define MIN_PASTE(A,B) A##B | |
#define MIN_IMPL(A,B,L) ({ __typeof__(A) MIN_PASTE(__a,L) = (A); __typeof__(B) MIN_PASTE(__b,L) = (B); MIN_PASTE(__a,L) < MIN_PASTE(__b,L) ? MIN_PASTE(__a,L) : MIN_PASTE(__b,L); }) | |
#define MIN(A,B) MIN_IMPL(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
#import <Foundation/Foundation.h> | |
@interface A: NSObject | |
@end | |
@implementation A | |
void pileOfPoo(id self, SEL _cmd) { | |
NSLog(@"💩"); | |
} |
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
- (BOOL)isNetworkActivityIndicatorVisible { | |
return _activityCount > 0; | |
} | |
- (void)incrementActivityCount { | |
[self willChangeValueForKey:@"activityCount"]; | |
OSAtomicIncrement32((int32_t*)&_activityCount); | |
[self didChangeValueForKey:@"activityCount"]; | |
} |
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
INFO=$( echo $TARGET_BUILD_DIR )/$( echo $INFOPLIST_PATH | sed -e 's/\.plist$//' ) | |
echo $INFO | |
TAG= | |
COMMIT= | |
CURRENT= | |
CURRENT_BUILD= | |
GITPATH=/usr/bin:/usr/local/bin:/usr/local/git/bin | |
PATH=$PATH:$GITPATH; export PATH | |
if [ -z $( which git ) ]; then |
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 <objc/runtime.h> | |
#import <stdlib.h> | |
// declare some of the Objective-C runtime's private parts where we can see them | |
typedef struct _NXMapTable NXMapTable; | |
extern NXMapTable *gdb_objc_realized_classes; | |
extern void *NXMapInsert(NXMapTable *table, const void *key, const void *value); | |
@implementation NSObject (Poser) |
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
// | |
// GHReadWriteQueue.h | |
// GitHub | |
// | |
// Created by Justin Spahr-Summers on 2014-03-24. | |
// Copyright (c) 2014 GitHub. All rights reserved. | |
// | |
#import <Foundation/Foundation.h> |
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
/////////////////////////////////////////////////////////////////////////////////////////// | |
#pragma mark - Warn if we KVO a weak property | |
// Doesn't support key paths. | |
static BOOL PSPDFIsWeakProperty(id object, NSString *keyPath) { | |
objc_property_t property = class_getProperty([object class], keyPath.UTF8String); | |
if (property) { | |
// https://developer.apple.com/library/mac/documentation/cocoa/conceptual/objcruntimeguide/articles/ocrtpropertyintrospection.html | |
const char *attributes = property_getAttributes(property); | |
return attributes && strstr(attributes, ",W"); |
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
// Convert an EXIF image orientation to an iOS one. | |
// reference see here: http://sylvana.net/jpegcrop/exif_orientation.html | |
+ (UIImageOrientation) exifOrientationToiOSOrientation:(int)exifOrientation { | |
UIImageOrientation o = UIImageOrientationUp; | |
switch (exifOrientation) { | |
case 1: o = UIImageOrientationUp; break; | |
case 3: o = UIImageOrientationDown; break; | |
case 8: o = UIImageOrientationLeft; break; | |
case 6: o = UIImageOrientationRight; break; |
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
// Smart little helper to find main thread hangs. Enable in appDidFinishLaunching. | |
// Only available with source code in DEBUG mode. | |
@interface PSPDFHangDetector : NSObject | |
+ (void)startHangDetector; | |
@end | |
@implementation PSPDFHangDetector | |
+ (void)startHangDetector { | |
#ifdef DEBUG |
OlderNewer