Skip to content

Instantly share code, notes, and snippets.

Avatar

Sash Zats zats

View GitHub Profile
@zats
zats / FindReplace.json
Last active Sep 23, 2021
Alternative spellings for some emojis according to /System/Library/PrivateFrameworks/CoreEmoji.framework/Versions/A/Resources/en.lproj/FindReplace.strings
View FindReplace.json
{
"💍":"diamond | engagement ring | diamond ring | diamond rings | diamonds | engagement rings",
"🆎":"blood type AB",
"❣":"heart",
"🇱🇨":"Saint Lucia | Saint Lucian flag",
"🇮🇪":"Ireland | Irish flag",
"🇨🇮":"Côte d’Ivoire | Ivory Coast | Ivorian flag",
"💎":"diamond | gem | gemstone | jewel | diamonds | gems | gemstones | jewels",
"☠️":"skull and crossbones | poison | poisonous",
"👩‍💻":"technology worker | tech worker | technologist | techie | IT worker | Apple genius | woman in technology | woman tech worker | woman technologist | woman IT worker | woman in IT | woman Apple genius",
@zats
zats / README.md
Last active Jul 11, 2021
Jeeves configuration sample
View README.md
  • routes – an array of route objects
    • request - configuration of a request.
      • method – a string according to RFC 2616.
      • pattern - a string to match, can be an escaped regex string. If regex is specified, it must match the entire request path.
    • response - configuration of the response.
      • resourcePath - relative path of the resource to serve, if the request was matched.
      • contentType - optional an override for the resource content type. By default it's automatically deduced from the file MIME type.
@zats
zats / rich-reminders.swift
Created Apr 7, 2018
This is a sample of how to add actionable button for Reminders (private API); demo video: https://youtu.be/q7LrO3VhI64
View rich-reminders.swift
import PlaygroundSupport
PlaygroundPage.current.needsIndefiniteExecution = true
let reminderListName = "Test"
import EventKit
extension EKCalendarItem {
var hack_action: AnyObject? {
set {
@zats
zats / ↔️.js
Created Feb 11, 2018
Bookmarklets for fullscreen, entering picture-in-picture, switching between fast and normal playback
View ↔️.js
javascript:document.getElementsByTagName('video')%5B0%5D.webkitEnterFullscreen()
@zats
zats / Node.h
Last active Mar 18, 2021
Implementing NSCopying, NSMutableCopying for immutable class with mutable counterpart
View Node.h
#import <Foundation/Foundation.h>
@interface Node : NSObject <NSCopying, NSMutableCopying>
@property (nonatomic, weak, readonly) Node *parent;
@property (nonatomic, strong, readonly) Node *left;
@property (nonatomic, strong, readonly) Node *right;
- (instancetype)initWithParent:(Node *)parent left:(Node *)left right:(Node *)right;
@end
@interface MutableNode : Node
@zats
zats / script.swift
Last active Mar 5, 2021
Update all your plugins for the latest Xcode beta with a single
View script.swift
#!/usr/bin/env xcrun swift
// $ chmod +x script.swift
// $ ./script.swift
// or $ ./script.swift -xcode=/Applications/Xcode-beta.app
import Foundation
@noreturn private func failWithError(message: String) {
print("🚫 \(message)")
View ZTSDynamicProxy.h
@interface ZTSDynamicProxy : NSProxy
+ (instancetype)dynamicProxyWithObject:(id)object;
@property (nonatomic, strong) id zts_object;
@end
@zats
zats / Problem.swift
Last active Oct 28, 2020
Recursive structures in Swift without Box classes
View Problem.swift
struct Node<T> { // error: recursive value type 'Node<T>' is not allowed
var child: Node?
var value: T
init(value: T, child: Node? = nil) {
self.value = value
self.child = child
}
}
@zats
zats / NSProcessInfo+WMLCompatibility.m
Created Oct 5, 2014
Backport of -[NSProcessInfo isOperatingSystemAtLeastVersion:]
View NSProcessInfo+WMLCompatibility.m
@implementation NSProcessInfo (WMLCompatibility)
+ (void)wml_addSelector:(SEL)originalSelector implementedWithSelector:(SEL)newSelector {
if (![self instancesRespondToSelector:originalSelector]) {
Method newMethod = class_getInstanceMethod(self, newSelector);
class_addMethod(self, originalSelector, method_getImplementation(newMethod), method_getTypeEncoding(newMethod));
}
}
+ (void)load {
View DebugOverrides.h
#import <UIKit/UIKit.h>
typedef NS_ENUM(NSInteger, DBGInterfaceStyleOverride) {
DBGInterfaceStyleOverrideNone = 0,
DBGInterfaceStyleOverrideLight,
DBGInterfaceStyleOverrideDark,
};
#ifdef __cplusplus
extern "C" {