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
NSDictionary *extensionInfo = [NSBundle.mainBundle objectForInfoDictionaryKey:@"NSExtension"]; | |
NSString *extensionPointIdentifier = extensionInfo[@"NSExtensionPointIdentifier"]; | |
if ([extensionPointIdentifier isEqualToString:@"com.apple.watchkit"]) { | |
NSLog(@"WatchKit extension"); | |
} else if ([extensionPointIdentifier isEqualToString:@"com.apple.widget-extension"]) { | |
NSLog(@"Widget extension"); | |
} else if (extensionPointIdentifier == nil) { | |
NSLog(@"iOS app"); | |
} else { | |
NSLog(@"Unknown extension type"); |
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 ([[NSWorkspace sharedWorkspace] absolutePathForAppBundleWithIdentifier:@"com.metakine.handsoff"]) | |
{ | |
NSAlert *alert = [NSAlert alertWithMessageText:@"Letter Opener found \"Hands Off!\" application" | |
defaultButton:@"OK" | |
alternateButton:nil | |
otherButton:nil | |
informativeTextWithFormat:@"Make sure connections to www.creativeinaustria.com are allowed in \"Hands Off!\""]; | |
[alert setIcon:[NSImage imageNamed:OMiCIcon]]; | |
[alert runModal]; | |
} |
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
+ (NSAppleEventDescriptor*)mm_appleEventWithEventClass:(AEEventClass)eventClass | |
eventID:(AEEventID)eventID | |
targetApplicationBundleID:(NSString*)bundleID | |
{ | |
//NSAppleEventDescriptor *target = [NSAppleEventDescriptor descriptorWithDescriptorType:typeApplicationBundleID | |
// data:[bundleID dataUsingEncoding:NSUTF8StringEncoding]]; | |
NSAppleEventDescriptor *target = [self mm_targetDescriptorForBundleID:bundleID]; | |
return [NSAppleEventDescriptor appleEventWithEventClass:eventClass | |
eventID:eventID |
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> | |
// NSTextField has alignmentRectInsets = {.left=.right=3, .top=.bottom=0}, so | |
// when autolayout aligns NSTextField to its container's side margin (e.g. to x=0), | |
// the actual x position is -3, and the label gets clipped. | |
// | |
// ATUnclippedTextField compensates for that by overriding drawRect to extend | |
// the clipping rect by alignmentRectInsets. | |
// |
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
total time: 6.2 seconds (100.0%) | |
total images loaded: 347 | |
total segments mapped: 1278, into 78370 pages with 7272 pages pre-fetched | |
total images loading time: 2.2 seconds (36.4%) | |
total dtrace DOF registration time: 0.29 milliseconds (0.0%) | |
total rebase fixups: 2,318,756 | |
total rebase fixups time: 158.44 milliseconds (2.5%) | |
total binding fixups: 284,875 | |
total binding fixups time: 113.78 milliseconds (1.8%) | |
total weak binding fixups time: 2.00 milliseconds (0.0%) |
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/bash | |
# This script downloads and builds the iOS, tvOS and Mac openSSL libraries with Bitcode enabled | |
# Credits: | |
# https://github.com/st3fan/ios-openssl | |
# https://github.com/x2on/OpenSSL-for-iPhone/blob/master/build-libssl.sh | |
# https://gist.github.com/foozmeat/5154962 | |
# Peter Steinberger, PSPDFKit GmbH, @steipete. | |
# Felix Schwarz, IOSPIRIT GmbH, @felix_schwarz. |
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
public class ByteRangeRequestsController extends Controller { | |
// 206 Partial content Byte range requests | |
private static Result stream(long start, long length, File file) throws IOException { | |
FileInputStream fis = new FileInputStream(file); | |
fis.skip(start); | |
response().setContentType(MimeTypes.forExtension("mp4").get()); | |
response().setHeader(CONTENT_LENGTH, ((length - start) +1l)+""); | |
response().setHeader(CONTENT_RANGE, String.format("bytes %d-%d/%d", start, length,file.length())); |
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
/// Performs `block` immediately and ignores subsequent calls during the same runloop. | |
#define pspdf_ensureCalledOnlyOncePerRunloop(block) do { \ | |
static const char __onceKey; _pspdf_ensureCalledOnlyOncePerRunloop(self, &__onceKey, block); } while(0) | |
extern void _pspdf_ensureCalledOnlyOncePerRunloop(id self, const void *key, dispatch_block_t block); | |
void _pspdf_ensureCalledOnlyOncePerRunloop(id self, const void *key, dispatch_block_t block) { | |
NSCParameterAssert(block); | |
NSCParameterAssert(self); | |
PSPDFAssertOnMainThread(); // run loop needs the main thread. |
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
# This is clicking "Allow" in System Preferences "Security & Privacy" screen | |
# when you're on Screen Sharing. Otherwise it doesn't work. | |
# To fix: | |
# - Put "Security & Privacy" window in the top left screen | |
# - open a Terminal on a side | |
# - save click.oscript | |
# - Run: osascript click.oscript | |
# | |
# The mouse click you send should hit "Allow" button. You may need to move the window a little bit. | |
# Script originally from: https://discussions.apple.com/thread/3708948 |
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)moveToURL:(NSURL *)url completionHandler:(void (^ __nullable)(NSError * __nullable))completionHandler | |
{ | |
NSError *error = nil; | |
NSURL *adjustedURL = nil; | |
if (![[url pathExtension] isEqualToString:@"testextension"]) { | |
adjustedURL = [url URLByAppendingPathExtension:@"testextension"]; | |
} |
OlderNewer