- Proposal: SE-TBD
- Author(s): Dave DeLong
- Review manager: TBD
- Status: TBD
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 CODE IS FOR EDUCATIONAL PURPOSES ONLY. | |
I'M NOT RESPONSIBLE IF YOU SHIP THIS AND IT BLOWS UP IN YOUR FACE. | |
IF IT DOES AND YOU COMPLAIN TO ME I WILL LAUGH AT YOU. |
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
on setDarkMode(shouldBeDark) | |
set paneID to "com.apple.preference.general" | |
tell application "System Events" | |
if dark mode of appearance preferences is shouldBeDark then return | |
end tell | |
set paneWasOpen to false | |
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
@interface DDControlledView : NSView | |
@property (weak) IBOutlet NSViewController *viewController; | |
@end | |
@implementation DDControlledView | |
- (void)setNextResponder:(NSResponder *)aResponder { | |
NSViewController *controller = self.viewController; |
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
@interface DDDelegateProxy : NSProxy | |
+ (id)proxyForDelegate:(id)delegate conformingToProtocol:(Protocol *)protocol; | |
@property (weak, readonly) id delegate; | |
@property (strong, readonly) Protocol *protocol; | |
/*! | |
* Set a default return value for a method on the delegate's protocol. | |
* \param value This must be a block that returns the default value. Bad Things will happen if it's not. |
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
# Automatically increment the CFBundleVersion in release builds | |
config=${CONFIGURATION} | |
if [ "${config}" = "Release" ]; then | |
buildNumber=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "${PROJECT_DIR}/${INFOPLIST_FILE}") | |
buildNumber=$(($buildNumber + 1)) | |
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $buildNumber" "${PROJECT_DIR}/${INFOPLIST_FILE}" | |
else | |
echo "info: Skipping build number incrementation in ${config} mode" |
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 <IOKit/IOKitLib.h> | |
#import <IOKit/usb/IOUSBLib.h> | |
int main() { | |
NSMutableDictionary *match = (__bridge NSMutableDictionary *)IOServiceMatching("IOUSBDevice"); | |
if (match == nil) { return -1; } | |
match[@"IOPropertyMatch"] = @{@"SupportsIPhoneOS": @YES}; | |
io_iterator_t iterator = 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
on pad(thisNumber) | |
set thisText to thisNumber as text | |
if length of thisText = 1 then | |
return "0" & thisText | |
else | |
return thisText | |
end if | |
end pad |
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
fileprivate let tileBaseH = Array(""" | |
┏━━┳━━┓ | |
┃ ┃ ┃ | |
┗━━┻━━┛ | |
""") | |
fileprivate let tileBaseV = Array(""" | |
┏━━┓ | |
┃ ┃ | |
┣━━┫ |
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
// obviously, we'll need a japanese calendar | |
let jp = Calendar(identifier: .japanese) | |
// this is a date formatter that, when formatting a date, gives us the full readable name of the date's era | |
let jpf = DateFormatter() | |
// see also: https://unicode.org/reports/tr35/tr35-dates.html#Date_Format_Patterns | |
jpf.dateFormat = "GGGG" | |
jpf.calendar = jp | |
// ranges are numbered starting at 0 |
NewerOlder