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
// Assume base path is your Desktop | |
NSURL * baseFileURL = [[[NSFileManager defaultManager] URLsForDirectory:NSDesktopDirectory inDomains:NSUserDomainMask] lastObject]; | |
NSURL * fileURL = [baseFileURL URLByAppendingPathComponent:@"__FILE_NAME__"]; | |
// the keys we are interested in | |
NSArray * attrArray = @[NSURLIsPackageKey, NSURLIsRegularFileKey, NSURLIsWritableKey, NSURLIsDirectoryKey]; | |
NSDictionary * theDict = [fileURL resourceValuesForKeys:attrArray error:nil]; | |
NSLog(@"the dict: %@", theDict); |
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
<html> | |
<head> | |
<title>Focus ring</title> | |
<meta name="author" content="Headnix"> | |
<style type="text/css" media="screen"> | |
.thumbnail { | |
width: 100px; | |
height: 100px; | |
background-color: #eee; | |
} |
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)waitForCompletion { | |
runloopExpirationTimer = [NSTimer scheduledTimerWithTimeInterval:600.0 target:self selector:@selector(dumbTimerMethod:) userInfo:nil repeats:NO]; | |
while ( !executionDone ) { | |
[[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate distantFuture]]; | |
} | |
} | |
- (void)dumbTimerMethod:(NSTimer *)theTimer { | |
runloopExpirationTimer = 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
codesign --display --entitlements - Atttach.app | |
Don't forget the "-" in the command |
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 it's a horizontal divider... | |
[_splitView setPosition:_splitView.bounds.size.height ofDividerAtIndex:0]; | |
// Make sure NSSplitViewDelegate implements "- (BOOL)splitView:(NSSplitView *)splitView canCollapseSubview:(NSView *)subview" |
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
{ | |
"name":"Product name", | |
"price": 876, | |
"barcode": "908w839827983742973", | |
"sku": "hello", | |
"another": "just a value" | |
} |
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
{ | |
"$schema": "http://json-schema.org/draft-04/schema#", | |
"description": "", | |
"type": "object", | |
"patternProperties": { | |
"^(price|barcode|sku)$": { | |
"anyOf":[ | |
{ | |
"type": "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
//: Playground - noun: a place where people can play | |
import Cocoa | |
let now = Date() | |
let earlierDate = Date(timeIntervalSinceNow: -2 * 24 * 3600) | |
switch Date() { | |
case now..<earlierDate: | |
print("hello") |