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
void TSCreateImageFromIOSurfaceReleaseCallback(void * __nullable info, const void *data, size_t size); | |
void TSCreateImageFromIOSurfaceReleaseCallback(void * __nullable info, const void *data, size_t size) { | |
CFRelease(info); | |
} | |
CGImageRef TSCreateImageFromIOSurface(IOSurfaceRef surface, CGColorSpaceRef cs) { | |
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
NSWorkspace *workspace = [NSWorkspace sharedWorkspace]; | |
NSDictionary *activeAppDict = [workspace activeApplication]; | |
ProcessSerialNumber psn; | |
psn.highLongOfPSN = [[activeAppDict objectForKey:@"NSApplicationProcessSerialNumberHigh"] intValue]; | |
psn.lowLongOfPSN = [[activeAppDict objectForKey:@"NSApplicationProcessSerialNumberLow"] intValue]; | |
SetFrontProcess( &psn ); |
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
NSImageRep *originalCursorRep = [originalCursorImage bestRepresentationForRect:NSMakeRect(0, 0, [originalCursorImage size].width * retinaScale, [originalCursorImage size].height * retinaScale) context:nil hints:[NSDictionary dictionaryWithObject:[NSAffineTransform transform] forKey:NSImageHintCTM]]; |
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
[db makeFunctionNamed:@"UTTypeConformsTo" maximumArguments:2 withBlock:^(sqlite3_context *context, int argc, sqlite3_value **argv) { | |
if (sqlite3_value_type(argv[0]) == SQLITE_TEXT) { | |
const unsigned char *a = sqlite3_value_text(argv[0]); | |
const unsigned char *b = sqlite3_value_text(argv[1]); | |
CFStringRef as = CFStringCreateWithCString(0x00, (const char*)a, kCFStringEncodingUTF8); | |
CFStringRef bs = CFStringCreateWithCString(0x00, (const char*)b, kCFStringEncodingUTF8); | |
sqlite3_result_int(context, UTTypeConformsTo(as, bs)); |
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 Cocoa | |
import ImageIO | |
import CoreGraphics | |
var cs = CGColorSpaceCreateDeviceRGB(); | |
var bitmapOptions = CGBitmapInfo.byteOrder16Little.rawValue | CGImageAlphaInfo.premultipliedLast.rawValue; | |
var bitmapContext = CGContext(data: nil, width: 10, height: 10, bitsPerComponent: 16, bytesPerRow: 0, space: cs, bitmapInfo: bitmapOptions); |
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
118973149535723176502126385303097020516906332229462420044032373389173700552297072261641029033652888285354569780749557731442744315367028843419812557385374367867359320070697326320191591828296152436552951064679108661431179063216977883889613478656060039914875343321145491116008867984515486651285234014977303760000912547939396622315138362241783854274391783813871780588948754057516822634765923557697480511372564902088485522249479139937758502601177354918009979622602685950855888360815984690023564513234659447638493985 |
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 Boolean MOObjectEqual(const id value1, const id value2) { | |
debug(@"(id)value1: '%@'", NSStringFromClass([(id)value1 class])); | |
debug(@"(id)value2: '%@'", NSStringFromClass([(id)value2 class])); | |
debug(@"[(id)value1 isKindOfClass:[NSString class]]: %d", [(id)value1 isKindOfClass:[NSString class]]); | |
debug(@"[(id)value2 isKindOfClass:[NSString class]]: %d", [(id)value2 isKindOfClass:[NSString class]]); | |
return (Boolean)[(id)value1 isEqual:(id)value2]; | |
} |
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
var list = """George Washington | |
John Adams | |
Thomas Jefferson | |
James Madison | |
James Monroe | |
John Quincy Adams | |
Andrew Jackson | |
Martin Van Buren | |
William Henry Harrison | |
John Tyler |
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
NSImage *iRep = [NSImage imageNamed:[fileName stringByDeletingPathExtension]]; | |
if (iRep) { | |
NSImage *ni = [[NSImage alloc] initByReferencingFile:output]; | |
for (NSImageRep *r in [[iRep representations] copy]) { | |
[iRep removeRepresentation:r]; | |
} | |
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 <Cocoa/Cocoa.h> | |
@interface FMSimpleBlockAnimation : NSAnimation { | |
void (^_animationBlock)(float t); | |
} | |
- (void)animateWithBlock:(void(^)(float t))block; | |
@end |