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 <math.h> | |
static inline BOOL FloatEqual(float a, float b) { | |
return (fabs(a-b) < FLT_EPSILON); | |
} |
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
struct LevelHeader { | |
int64_t checksum; | |
int32_t version; | |
int64_t signature; | |
int32_t instance_count; | |
int32_t name_count; | |
int32_t template_count; | |
int32_t data_offset; |
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
const char *exec_path = [[[NSBundle mainBundle] executablePath] cStringUsingEncoding:NSUTF8StringEncoding]; |
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
if (((graph[n].p2 == graph[j].p1) || ((graph[n].p1 == graph[j].p2) && (!compareEdge(graph[n],graph[j])))) && !graph[j].visited) { | |
//... | |
} |
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
#if defined(CONFIGURATION_Debug) | |
#define NSLog( s, ... ) NSLog(@"[%p %@:(%d)] %@ %@", self, [[NSString stringWithUTF8String:__FILE__] lastPathComponent], __LINE__, [NSString stringWithUTF8String:__PRETTY_FUNCTION__], [NSString stringWithFormat:(s), ##__VA_ARGS__]) | |
#else | |
#define NSLog( s, ... ) | |
#endif |
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
// cg is a set of objects that describe the properties of onscreen windows (app, frame, title, etc) | |
// this is comparing all of them to find the windows that are menubar items | |
NSSet *menubar = [NSSet setWithArray:[[cg allObjects] objectsAtIndexes:[[cg allObjects] indexesOfObjectsPassingTest:^BOOL(WindowObject *obj, NSUInteger idx, BOOL *stop) { return CGRectContainsRect(SystemMenuBarRect(), CGRectMake(obj.window_origin.x, obj.window_origin.y, obj.window_size.width, obj.window_size.height)); }]]]; | |
/* | |
Notes: | |
static CGRect SystemMenuBarRect() { | |
CGRect main_bounds = CGDisplayBounds(CGMainDisplayID()); | |
CGFloat system_height = [[NSStatusBar systemStatusBar] thickness]; | |
return CGRectMake(main_bounds.origin.x, main_bounds.origin.y, main_bounds.size.width, system_height); |
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
float value = (slider.value - slider.minimumValue); | |
float px_per_val = (slider.frame.size.width)/(slider.maximumValue - slider.minimumValue); | |
float position = (px_per_val * value) + 20; |
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
<?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>Type</key> | |
<string>PSMultiValueSpecifier</string> | |
<key>Title</key> | |
<string>Prefix</string> | |
<key>DefaultValue</key> | |
<string>Clarity</string> |
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
for (NSScreen *screen in [NSScreen screens]) { | |
NSWindow *new_window = [[NSWindow alloc] initWithContentRect:screen.frame styleMask:NSBorderlessWindowMask backing:NSBackingStoreRetained defer:NO]; | |
[new_window setLevel:kCGScreenSaverWindowLevel]; | |
[new_window makeKeyAndOrderFront:nil]; | |
} |
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 IS_IPAD (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)? YES : NO | |
... | |
NSLog(@"%@",(IS_IPAD == TRUE ? @"YES" : @"NO")); |
OlderNewer