Skip to content

Instantly share code, notes, and snippets.

View zats's full-sized avatar

Sash Zats zats

View GitHub Profile
@zats
zats / EnableVoiceOver.m
Last active September 24, 2023 16:46
Set voice over enabled with private API - not for AppStore
static void _setVoiceOver(BOOL enabled) {
NSString* const accessibilityUtilitiesPath = [[NSBundle bundleForClass:UIApplication.class]
.bundleURL
.URLByDeletingLastPathComponent
.URLByDeletingLastPathComponent
URLByAppendingPathComponent:@"PrivateFrameworks/AccessibilityUtilities.framework/AccessibilityUtilities"]
.relativePath;
void* handler = dlopen([accessibilityUtilitiesPath cStringUsingEncoding:NSUTF8StringEncoding], RTLD_NOW);
if (!handler) {
return;
@zats
zats / rich-reminders.swift
Created April 7, 2018 21:08
This is a sample of how to add actionable button for Reminders (private API); demo video: https://youtu.be/q7LrO3VhI64
import PlaygroundSupport
PlaygroundPage.current.needsIndefiniteExecution = true
let reminderListName = "Test"
import EventKit
extension EKCalendarItem {
var hack_action: AnyObject? {
set {
@zats
zats / gist:1a3fe941251b4a32b531
Created June 12, 2014 15:02
Enabling UIImageRenderingModeAlwaysTemplate for UIImageView
static NSString *const WMLTemplatedAnimationColorFillLayerName = @"WMLTemplatedAnimationFillLayerName";
static NSString *const WMLTemplatedAnimationMaskLayerName = @"WMLTemplatedAnimationMaskLayerName";
@interface UIImageView (WMLTemplatedAnimation)
- (void)wml_startAnimating;
- (void)wml_stopAnimating;
@end
#import <UIKit/UIKit.h>
typedef NS_ENUM(NSInteger, DBGInterfaceStyleOverride) {
DBGInterfaceStyleOverrideNone = 0,
DBGInterfaceStyleOverrideLight,
DBGInterfaceStyleOverrideDark,
};
#ifdef __cplusplus
extern "C" {
@zats
zats / ApplePodcastToOMPL.js
Last active December 6, 2021 01:20
Export OPML from Apple Podcasts app on macOS
#!/usr/bin/env node
const { exit } = require('process');
const PREDEFINED_PATH = "~/Library/Group Containers/243LU875E5.groups.com.apple.podcasts/Documents/MTLibrary.sqlite";
const XML_TEMPLATE = `<?xml version="1.0"?>
<!-- example OPML file -->
<opml version="1.0">
<head>
<title>Overcast Podcast Subscriptions</title>
@zats
zats / Problem.swift
Last active November 4, 2021 08:40
Recursive structures in Swift without Box classes
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 / README.md
Last active July 11, 2021 16:06
Jeeves configuration sample
  • 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 / ↔️.js
Created February 11, 2018 22:00
Bookmarklets for fullscreen, entering picture-in-picture, switching between fast and normal playback
javascript:document.getElementsByTagName('video')%5B0%5D.webkitEnterFullscreen()
@zats
zats / Node.h
Last active March 18, 2021 17:48
Implementing NSCopying, NSMutableCopying for immutable class with mutable counterpart
#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 March 5, 2021 01:32
Update all your plugins for the latest Xcode beta with a single
#!/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)")