View tttt.swift
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
// 1. copy file to $PATH somewhere | |
// 2. chmod a+x it | |
// 3. run with `tttt` or `tttt [task to track]` | |
// 4. check out ~/Desktop/todo.txt | |
#!/usr/bin/env swift | |
import Foundation | |
let dateFormatter = DateFormatter() |
View framework-diff.sh
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
set -x | |
set -k INTERACTIVE_COMMENTS=1 # treats everything after # as being a comment | |
# vars | |
export XCODE_RELEASE_PATH="/Applications/Xcode-11.5.app" | |
export XCODE_BETA_PATH="/Applications/Xcode-12-beta.app" | |
export XCODE_FRAMEWORKS_PATH="Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks" | |
export OUTPUT="${HOME}/Desktop/iosapidiff" | |
mkdir "${OUTPUT}" |
View UIBezierPath+Smoothing.swift
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 UIKit | |
extension UIBezierPath { | |
// reference: https://github.com/erica/iOS-6-Cookbook/blob/master/C01%20Gestures/08%20-%20Smoothed%20Drawing/UIBezierPath-Points.m | |
var points: [CGPoint] { | |
var bezierPoints = [CGPoint]() | |
cgPath.applyWithBlock { (element: UnsafePointer<CGPathElement>) in | |
if element.pointee.type != .closeSubpath { | |
bezierPoints.append(element.pointee.points.pointee) |
View steps.txt
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
# fetch MacPorts sources | |
curl -LO https://distfiles.macports.org/MacPorts/MacPorts-2.4.1.tar.gz | |
# extract them and get into the dir | |
tar -jxf MacPorts-2.4.1.tar.gz | |
cd MacPorts-2.4.1 | |
# configure things | |
## If you want MacPorts to run in a custom prefix, pass in the following arguments: --prefix=/usr/local --with-unsupported-prefix --with-applications-dir=/Applications | |
./configure --with-no-root-privileges --with-install-user=$USER --with-install-group=staff --silent |
View ??.swift
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
infix operator ?? : Branching | |
precedencegroup Branching { | |
associativity: left | |
lowerThan: ComparisonPrecedence // also accounts for NilCoalescingPrecedence | |
} | |
/// Ternary-y operators without an else clause | |
/// | |
/// - Parameter lhs: The Boolean value to evaluate |
View icons.jsx
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
var originalDocumentSize = 1024 | |
var folder = Folder.selectDialog(); | |
var document = app.activeDocument; | |
document.artboards.setActiveArtboardIndex(0); | |
if (document && document.artboards[0]) { | |
// Icons for Universal Apps; https://developer.apple.com/library/content/qa/qa1686/_index.html | |
scaleArtboardAndSave((512 / originalDocumentSize) * 100); |
View A.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
NS_ASSUME_NONNULL_BEGIN | |
@interface WObject : NSObject <NSCopying, NSSecureCoding> | |
+ (instancetype) objectWithJSONRepresentation:(NSDictionary *) JSONRepresentation; | |
+ (instancetype) objectWithJSONRepresentation:(NSDictionary *) JSONRepresentation excludingKeys:(NSArray *__nullable) keys; | |
+ (NSString *__nullable) replacementKeyForKey:(NSString *__nonnull) key; | |
+ (NSFormatter *__nullable) formatterForKey:(NSString *__nonnull) key; | |
+ (NSValueTransformer *__nullable) transformerForKey:(NSString *__nonnull) key; |
View Demo.m
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 NSUserDefaults (idk) | |
@property (nonatomic, copy) NSString *jam; | |
@end | |
@implementation AppDelegate | |
- (void)applicationDidFinishLaunching:(NSNotification *)notification { | |
[NSUserDefaults standardUserDefaults].jam = @"strawberry"; | |
NSLog(@"%@", [NSUserDefaults standardUserDefaults].jam); | |
} | |
@end |
View CV.m
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 <CoreMedia/CoreMedia.h> | |
#import <CoreVideo/CoreVideo.h> | |
#import <UIKit/UIKit.h> | |
// https://developer.apple.com/library/content/qa/qa1702/_index.html | |
+ (UIImage * _Nullable)imageWithSampleBuffer:(CMSampleBufferRef _Nonnull)sampleBuffer { | |
UIImage *returnValue = nil; | |
CVImageBufferRef imageBuffer = CMSampleBufferGetImageBuffer(sampleBuffer); | |
CVPixelBufferLockBaseAddress(imageBuffer, 0); { |
View beep.swift
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 protocol SectionData { | |
static func numberOfRows(expanded: Bool) -> Int | |
func cell(from tableView: UITableView) -> UITableViewCell | |
} | |
fileprivate enum Section: Int { | |
case x | |
case y |
NewerOlder