Skip to content

Instantly share code, notes, and snippets.

View alexrepty's full-sized avatar
🌈
Andrà tutto bene!

Alexander Repty alexrepty

🌈
Andrà tutto bene!
View GitHub Profile
@catlan
catlan / README.md
Last active May 10, 2024 15:04 — forked from zrxq/.lldbinit
Execute lldb command and open its output in Kaleidoscope diff

Diff output of two lldb commands

Setup

  1. Copy the contents of the last snippet (lldbinit) from the gist page, and paste into your .lldbinit file. This makes the ksdiff macro known inside lldb.
  2. Put file ksdiff.py in ~/.lldb/
  3. sudo pip install temp
  4. Restart Xcode debug session

Example

(lldb) ksdiff ;

@rsattar
rsattar / UserNotifications.swift
Created February 27, 2016 00:34
Swift script that shows how to deliver notifications to OS X Notification Center using purely CLI. This can be pasted into a Playground and executed, too.
import Foundation
// Create a method that will be called instead of
// "bundleIdentifier()" that returns a non-empty
// bundle id, even for a CLI script
extension NSBundle {
func fakeBundleIdentifier() -> NSString {
if self == NSBundle.mainBundle() {
return "dont.mind.me.totally.a.normal.bundleid"
} else {
@macguru
macguru / gist:b7a01e3f0e9ae6f350d5
Last active May 10, 2020 20:58
Interface sizes a regular Universal app must support with iOS 11 when supporting all devices. Starts with iPhone 5 and goes up to iPad Pro 12.9".
COMPACT WIDTH (stacked view)
- 320 x 568 pt
-> iPhone 5, 5s
- 320 x 768 pt
-> iPad 9.7" Split Landscape 2/3 right
- 320 x 834 pt
-> iPad 10.5" Split Landscape 2/3 right
- 320 x 1024 pt
-> iPad 9.7" Split Portrait right
/**
Provides the ability to verify key paths at compile time.
If "keyPath" does not exist, a compile-time error will be generated.
Example:
// Verifies "isFinished" exists on "operation".
NSString *key = SQKeyPath(operation, isFinished);
// Verifies "isFinished" exists on self.
@isaacs
isaacs / patriarchy.md
Last active April 8, 2018 01:35
On "Patriarchy" and Homophobia
@steipete
steipete / UIKitLegacyDetector.m
Last active March 12, 2024 13:57
A simple way to detect at runtime if we're running in UIKit legacy mode or the new "flat" variant. Written for our PDF iOS SDK (http://pspdfkit.com), where the precompiled binary needs to detect at runtime in what variant it's running. Want more stuff like that? Follow me on Twitter: http://twitter.com/steipete
// Taken from http://PSPDFKit.com. This snippet is under public domain.
#define UIKitVersionNumber_iOS_7_0 0xB57
BOOL PSPDFIsUIKitFlatMode(void) {
static BOOL isUIKitFlatMode = NO;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
// We get the modern UIKit if system is running >= iOS 7 and we were linked with >= SDK 7.
if (kCFCoreFoundationVersionNumber >= kCFCoreFoundationVersionNumber_iOS_7_0) {
isUIKitFlatMode = (NSVersionOfLinkTimeLibrary("UIKit") >> 16) >= UIKitVersionNumber_iOS_7_0;
}
@jonathanpenn
jonathanpenn / gist:3792241
Created September 27, 2012 04:58
Using to-many predicates with UIAutomation
// Based on this discussion:
// https://twitter.com/listrophy/statuses/251074683594747904
// To setup:
// Create an application that has a tableView with a couple cells in it, one of
// which has the "coffee" in it's label
var target = UIATarget.localTarget();
var app = target.frontMostApp();
var window = app.mainWindow();
@mwaterfall
mwaterfall / gist:953657
Created May 3, 2011 16:24
Runtime iOS Version Checking
/*
* System Versioning Preprocessor Macros
*/
#define SYSTEM_VERSION_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedSame)
#define SYSTEM_VERSION_GREATER_THAN(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedDescending)
#define SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending)
#define SYSTEM_VERSION_LESS_THAN(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedAscending)
#define SYSTEM_VERSION_LESS_THAN_OR_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedDescending)