Skip to content

Instantly share code, notes, and snippets.

View mcomisso's full-sized avatar

Matteo Comisso mcomisso

View GitHub Profile
@tclementdev
tclementdev / libdispatch-efficiency-tips.md
Last active April 26, 2024 10:15
Making efficient use of the libdispatch (GCD)

libdispatch efficiency tips

The libdispatch is one of the most misused API due to the way it was presented to us when it was introduced and for many years after that, and due to the confusing documentation and API. This page is a compilation of important things to know if you're going to use this library. Many references are available at the end of this document pointing to comments from Apple's very own libdispatch maintainer (Pierre Habouzit).

My take-aways are:

  • You should create very few, long-lived, well-defined queues. These queues should be seen as execution contexts in your program (gui, background work, ...) that benefit from executing in parallel. An important thing to note is that if these queues are all active at once, you will get as many threads running. In most apps, you probably do not need to create more than 3 or 4 queues.

  • Go serial first, and as you find performance bottle necks, measure why, and if concurrency helps, apply with care, always validating under system pressure. Reuse

@steventroughtonsmith
steventroughtonsmith / Tweak.xm
Created October 14, 2015 06:33
iOS 9 Enable Splitscreen Jailbreak Tweak (Theos)
/* How to Hook with Logos
Hooks are written with syntax similar to that of an Objective-C @implementation.
You don't need to #include <substrate.h>, it will be done automatically, as will
the generation of a class list and an automatic constructor.
%hook ClassName
// Hooking a class method
+ (id)sharedInstance {
@leonaka
leonaka / gist:51c1de59b64c863932f0
Created March 25, 2015 18:17
Tumblr- and Tweetbot-like view on top of UIActivityViewController, with appearance animation (put it on a subclass of UIActivityViewController)
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
CGFloat distance = 10.0;
[self.transitionCoordinator animateAlongsideTransition:^(id<UIViewControllerTransitionCoordinatorContext> context) {
[UIView performWithoutAnimation:^{
self.effectView.frame = CGRectMake(0, self.view.frame.size.height - self.effectView.frame.size.height - distance, self.view.frame.size.width, self.effectView.frame.size.height);
}];
self.effectView.frame = CGRectMake(0, -self.effectView.frame.size.height - distance), self.view.frame.size.width, self.effectView.frame.size.height);
@mnmaraes
mnmaraes / PaperAnimation
Last active May 23, 2017 15:30
Gist that seeks to emulate Paper's menu animation
//
// TUIViewController.m
// TestUIs
//
// Created by Murillo Nicacio de Maraes on 3/9/14.
// Copyright (c) 2014 m-one. All rights reserved.
//
#import "TUIViewController.h"
ACTION
AD_HOC_CODE_SIGNING_ALLOWED
ALTERNATE_GROUP
ALTERNATE_MODE
ALTERNATE_OWNER
ALWAYS_SEARCH_USER_PATHS
ALWAYS_USE_SEPARATE_HEADERMAPS
APPLE_INTERNAL_DEVELOPER_DIR
APPLE_INTERNAL_DIR
APPLE_INTERNAL_DOCUMENTATION_DIR