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 | |
# Some things taken from here | |
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx | |
# Ask for the administrator password upfront | |
sudo -v | |
# Keep-alive: update existing `sudo` time stamp until script has finished | |
while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null & |
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)drawInRect:(CGRect)rect { | |
CGSize shadowOffset = CGSizeMake(0, -1); | |
float colorValues[] = {0, 0, 0, .9}; | |
CGContextRef ctx = UIGraphicsGetCurrentContext(); | |
CGContextSaveGState(ctx); | |
CGContextSetShadow (ctx, shadowOffset, 1); | |
CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); | |
CGColorRef color = CGColorCreate(colorSpace, colorValues); |
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)resizeWindowForContentSize:(NSSize)size animated:(BOOL)animated { | |
NSRect windowFrame = [self contentRectForFrameRect:[self frame]]; | |
NSRect newWindowFrame = [self frameRectForContentRect: | |
NSMakeRect( NSMinX( windowFrame ), NSMaxY( windowFrame ) - size.height, size.width, size.height )]; | |
[self setFrame:newWindowFrame display:YES animate:animated]; | |
} |
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> | |
#import <CoreLocation/CoreLocation.h> | |
typedef void (^JWLocationManagerCallback)(CLLocation *location); | |
typedef void (^JWLocationManagerErrorCallback)(NSError *error); | |
@interface JWLocationManager : NSObject <CLLocationManagerDelegate> | |
@property (nonatomic, copy) NSString *purpose; | |
@property (nonatomic, copy) JWLocationManagerCallback locationUpdatedBlock; |
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
- (id)initWithFrame:(NSRect)frame { | |
self = [super initWithFrame:frame]; | |
if (!self) return nil; | |
self.layer = [CAScrollLayer layer]; | |
self.wantsLayer = YES; | |
self.layerContentsRedrawPolicy = NSViewLayerContentsRedrawNever; | |
return self; | |
} |
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
RAC(self.someOrderedSet) = [[[[[[RACAble(self.searchField.text) | |
filter:^BOOL(NSString *text) { | |
return (text.length > 0); | |
}] | |
map:^id(NSString *text) { | |
return [Something searchForAutocomplete:text]; // this signal can send errors | |
}] | |
switchToLatest] | |
catchTo:[RACSignal return:[NSArray array]]] | |
map:^id(NSArray *objects) { |
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> | |
typedef void (^JNWGroupAsyncOperationCompletion)(); | |
@interface JNWGroupAsyncOperation : NSObject | |
// The completion block that will be fired when all operations have completed. | |
@property (nonatomic, copy) void(^groupCompletion)(); | |
// Adds an asynchronous operation and starts it on the main thread. The completion block _must_ |
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
// | |
// QTMAsyncOperationQueue.h | |
// Quantum | |
// | |
// Created by Jonathan Willing on 10/28/13. | |
// Copyright (c) 2013 AppJon. 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
[NSAnimationContext runAnimationGroup:^(NSAnimationContext *context) { | |
context.duration = 4.f; | |
context.allowsImplicitAnimation = YES; | |
[view.layer addAnimation:CATransition.animation forKey:@"contents"]; | |
view.layer.contents = someImage; | |
} completionHandler: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
#import <Foundation/Foundation.h> | |
@interface NSString (IBNMetrics) | |
- (CGSize)ibn_sizeConstrainedToSize:(CGSize)size font:(NSFont *)font; | |
- (CGSize)ibn_sizeWithFont:(NSFont *)font; | |
@end |
OlderNewer