Skip to content

Instantly share code, notes, and snippets.

View numist's full-sized avatar

Scott Perry numist

View GitHub Profile
- (BOOL)isNetworkActivityIndicatorVisible {
return _activityCount > 0;
}
- (void)incrementActivityCount {
[self willChangeValueForKey:@"activityCount"];
OSAtomicIncrement32((int32_t*)&_activityCount);
[self didChangeValueForKey:@"activityCount"];
}
@iamleeg
iamleeg / pileOfPoo.m
Created March 22, 2012 01:51
The pile of poo Objective-C method
#import <Foundation/Foundation.h>
@interface A: NSObject
@end
@implementation A
void pileOfPoo(id self, SEL _cmd) {
NSLog(@"💩");
}
@erisdev
erisdev / Poser.m
Created March 11, 2012 04:09
Miss +[NSObject poseAsClass:]? Don't use this, you might hurt yourself or someone you love.
#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)
@benstiglitz
benstiglitz / sys_param-better.h
Created August 11, 2011 15:37
Hygenic and shadow-safe MIN.
#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__)
@oogali
oogali / tmbo.sh
Created January 8, 2011 03:39
tmbo command-line uploader
#!/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]"