- Version numbers are either two or three numbers, separated by periods.
- Version numbers are two or three numbers, separated by periods, optionally followed by “a” or “b” or “rc” and optionally another number.
- Any valid combination of numbers separated by periods is a valid version number. (CFBundleVersion will disagree with you for sufficiently high numbers of digits. See also.)
- Version numbers can be parsed as floating-point/decimal numbers.
- OK, but at least the part before the “b” (or other letter) can be, right?
- Version numbers increase monotonically (e.g., 0.6 will never be greater than 1.0).
- The only valid non-release categories are development, alpha, beta, and release candidate.
- The version number will be prominently displayed to the user (e.g., Windows 4.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
//This validation method is completely generic; it dispatches to validate<Action>:, where <Action> is the item's action, duly initially-capitalized. | |
- (BOOL) validateUserInterfaceItem:(id <NSValidatedUserInterfaceItem>)item { | |
SEL action = [item action]; | |
if (![self respondsToSelector:action]) { | |
//We don't respond to the action, so unconditionally return NO. | |
return NO; | |
} | |
/*Determine the selector of the message to send ourselves for actual validation. | |
*/ |
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 requests | |
import os, re, sys | |
RE_SD_VIDEO = re.compile( | |
r'<a href="(http://devstreaming.apple.com/videos/wwdc/2013/[^"]*-SD.mov)') | |
RE_WEBVTT = re.compile(r'fileSequence[0-9]+\.webvtt') | |
# stdin: dump of https://developer.apple.com/wwdc/videos/ | |
for l in sys.stdin: | |
m = RE_SD_VIDEO.search(l) |
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
/*Usage: | |
* | |
*[debugLog log:@"Hello world"]; | |
* | |
*Only logs anything in debug builds: | |
*[debugLogOptional log:@"Fetched items: %lu", items.count]; | |
* | |
*/ | |
@interface PRHLogger: NSObject |
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
microSDs that fit in the space of a ProFile hard drive: 11 across * 10 up * 88 deep = 9680 | |
Total volume: 1597200.000000 cubic mm / 1.597200 liters | |
Total capacity (at 64 GiB per card): 619520 GiB / 605 TiB | |
Total capacity as percentage of 5 MB ProFile: 133040906.960896% | |
Total capacity as percentage of 10 MB ProFile: 66520453.480448% | |
Weight of Apple ProFile hard drive: 5 kg | |
Total weight of microSD cards: 2.420000 kg |
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 requests | |
import os, re, sys | |
RE_SD_VIDEO = re.compile( | |
r'<a href="(http://devstreaming.apple.com/videos/wwdc/2013/[^"]*-SD.mov)') | |
RE_WEBVTT = re.compile(r'fileSequence[0-9]+\.webvtt') | |
# stdin: dump of https://developer.apple.com/wwdc/videos/ | |
for l in sys.stdin: | |
m = RE_SD_VIDEO.search(l) |
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
https://bitbucket.org/boredzo/cpu-usage/src/c7100209293b37d9df4142441eee51ef0fcac7ce/CPUUsageView.m?at=modernization | |
This object (CPUUsageView) is an NSView subclass that draws, among other things, a percentage (0%–100%). To do this, it has, among other things, a C array of 101 blocks (closures). | |
When -reinitializeCache is called (upon changing the colors, frame rectangle, etc.), every location in the array is set to the same block, called the “slow path” block. | |
When the “slow path” block is called (by drawRect:, which is called by the system whenever the view needs to draw), the slow path block: | |
- Creates all of the objects needed to draw—interpolated colors, a framesetter object for fast, mid-level text drawing, etc. | |
- Creates a new block, the “fast path” block, specifically for this percentage. Blocks capture anything they use, so the fast path block captures all of those colors, framesetters, etc., and keeps them without any need of instance variables besides the array of blocks. (And indeed I used to |
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
100 Keynote | |
101 Platforms State of the Union | |
102 Apple Design Awards | |
109 Painting the Future | |
200 Accessibility in OS X | |
201 Building User Interfaces for iOS 7 | |
202 Accessibility in iOS | |
203 What’s New in Cocoa Touch | |
204 What’s New with Multitasking | |
205 What’s New in Cocoa |
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
// | |
// PRHAngleGradientFilter.h | |
// | |
// Created by Peter Hosey on 2013-01-30. | |
// Copyright (c) 2013 Peter Hosey. All rights reserved. | |
// | |
#import <QuartzCore/QuartzCore.h> | |
@interface PRHAngleGradientFilter : CIFilter |
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
//Formats a string in which format specifiers look like %(key)@, similar to Python's %(key)s. | |
//Currently does not work with any other specifiers (i/d/u/x/f/g/e/s/c/C) or formatting guidance (space-padding, justification, etc.), and probably will never allow mixing positional and keyed format specifiers, just as Python doesn't. | |
- (NSString *) stringWithFormat:(NSString *)format values:(NSDictionary *)values { | |
NSRegularExpression *regularExpression = [NSRegularExpression regularExpressionWithPattern:@"%\\(([a-z_][a-z0-9_]*)\\)@" | |
options:NSRegularExpressionCaseInsensitive | |
error:NULL]; | |
NSMutableString *resultString = [NSMutableString stringWithCapacity:format.length | |
+ [[[values allValues] valueForKeyPath:@"@sum.length"] unsignedIntegerValue]]; | |
__block NSRange rangeSinceLastMatch = { 0, 0 }; |