Skip to content

Instantly share code, notes, and snippets.

View romainbriche's full-sized avatar

Romain Briche romainbriche

View GitHub Profile
@brentsimmons
brentsimmons / headerview.m
Created April 26, 2014 22:09
UITableView header issues
#pragma mark - Class Methods
+ (BOOL)requiresConstraintBasedLayout {
return YES;
}
#pragma mark - Init
- (id)initWithFrame:(CGRect)frame {
@mnmaraes
mnmaraes / Mask UI
Last active June 29, 2016 10:33
Gist that seeks to emulate a color mask.
//
// TUIMaskViewController.m
// TestUIs
//
// Created by Murillo Nicacio de Maraes on 3/13/14.
// Copyright (c) 2014 m-one. All rights reserved.
//
#import "TUIMaskViewController.h"
@davedelong
davedelong / gist:7371853
Last active May 16, 2020 02:51
Delegate proxying (`protocol_methodForEach()` is a custom function that does just what its name implies)
@interface DDDelegateProxy : NSProxy
+ (id)proxyForDelegate:(id)delegate conformingToProtocol:(Protocol *)protocol;
@property (weak, readonly) id delegate;
@property (strong, readonly) Protocol *protocol;
/*!
* Set a default return value for a method on the delegate's protocol.
* \param value This must be a block that returns the default value. Bad Things will happen if it's not.
@jspahrsummers
jspahrsummers / gist:7080228
Last active May 2, 2019 11:56
Advantages and disadvantages to RACCommand under MVVM

MVVM example

For a command that initiates a network request when:

  • The network connection is up (precondition)
  • The network request is not already in progress (enforced serialization)

The lifecycle proceeds as follows:

  1. The view model exposes the command and describes its behavior
@hofmannsven
hofmannsven / README.md
Last active May 3, 2024 15:30
Git CLI Cheatsheet
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
@supermarin
supermarin / dash_emoji_snippets.sql
Last active January 30, 2020 19:58
Emoji in realtime with Dash.app Thanks @orta for putting this up. Read below for importing instructions
INSERT INTO 'snippets' ('title', 'body') VALUES
(':+1:', '👍'),
(':-1:', '👎'),
(':100:', '💯'),
(':1234:', '🔢'),
(':8ball:', '🎱'),
(':a:', '🅰'),
(':ab:', '🆎'),
(':abc:', '🔤'),
(':abcd:', '🔡'),
@krzysztofzablocki
krzysztofzablocki / Asserts
Created July 3, 2013 18:52
My take on assertions, code sample accompanying blog post at http://merowing.info/2013/07/expanded-use-of-asserts/
typedef NS_ENUM(NSInteger, kErrorCode) {
kErrorCodeInternal = 431432,
};
//! generate error and log it.
extern NSError *pixle_NSErrorMake(NSString *message, NSUInteger code, NSDictionary *aUserInfo, SEL selector);
#define AssertTrueOrReturnBlock(condition, block) do{ NSAssert((condition), @"Invalid condition not satisfying: %s", #condition);\
if(!(condition)) { block(pixle_NSErrorMake([NSString stringWithFormat:@"Invalid condition not satisfying: %s", #condition], kErrorCodeInternal, nil, _cmd)); return;} }while(0)
// Defines a yet undocumented method to add a warning if super isn't called.
#ifndef NS_REQUIRES_SUPER
#if __has_attribute(objc_requires_super)
#define NS_REQUIRES_SUPER __attribute((objc_requires_super))
#else
#define NS_REQUIRES_SUPER
#endif
#endif
@soffes
soffes / Podfile
Created May 13, 2013 15:46
Seesaw Podfile
platform :ios, '5.0'
# Awesome networking
pod 'AFNetworking'
# Backported UICollectionView
pod 'PSTCollectionView'
# Rich text
pod 'TTTAttributedLabel'