Skip to content

Instantly share code, notes, and snippets.

View hyperspacemark's full-sized avatar

Mark Adams hyperspacemark

View GitHub Profile
@hyperspacemark
hyperspacemark / gist:3987877
Created October 31, 2012 15:58
Dynamic cell height
@implementation TDLessonViewController
static CGFloat kMinimumLessonStepHeight = 88.0f;
static CGFloat kVerticalTextPadding = 20.0f;
static UIFont *kTextLabelFont;
static CGFloat kTextLabelFontSize = 15.0f;
static CGFloat kTextLabelWidth = 250.0f;
static UILineBreakMode kTextLabelLineBreakMode = UILineBreakModeWordWrap;
@protocol ATFetchedResultsControllerUpdateDelegate;
@interface ATFetchedResultsControllerDelegate : NSObject <NSFetchedResultsControllerDelegate>
@property (weak, nonatomic, readonly) UITableView *tableView;
@property (weak, nonatomic) id<ATFetchedResultsControllerUpdateDelegate> updateDelegate;
- (id)initWithTableView:(UITableView *)tableView;
@end
@interface ATParallaxTableHeaderView : UIView
@property (weak, nonatomic, readonly) UIView *contentView;
- (id)initWithContentView:(UIView *)contentView;
- (void)attachToTableView:(UITableView *)tableView;
@end
@hyperspacemark
hyperspacemark / 0_reuse_code.js
Created January 30, 2014 00:55
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
### Keybase proof
I hereby claim:
* I am 21x9 on github.
* I am markadams (https://keybase.io/markadams) on keybase.
* I have a public key whose fingerprint is 43B4 8536 20F7 3933 D352 F29D 5768 40B8 B28B C087
To claim this, I am signing this object:
enum CameraConnectionResult {
case Success(CameraType)
case Failure(NSError) // Really don't want this to be Optional<NSError>
}
class CameraClient {
class func connect(completion: CameraConnectionResult -> ()) {
let URL = NSURL(string: "http://10.5.5.9:8080/videos/MISC/version.txt")
if let versionURL = URL {
let configuration = NSURLSessionConfiguration.defaultSessionConfiguration()
@interface NetworkActivityStatus : NSObject
+ (instancetype)sharedStatus;
- (void)pushNetworkActivity;
- (void)popNetworkActivity;
@end
@interface LocationController () <CLLocationManagerDelegate>
@property (nonatomic) CLLocationManager *locationManager;
@end
@implementation LocationController
- (RACSignal *)locationUpdate
{
@hyperspacemark
hyperspacemark / RageMap.swift
Created August 21, 2015 21:32
A new implementation of `flatMap(f:)` added to `SequenceType` in Swift 2.0.
extension SequenceType {
/// Return an `Array` containing the non-nil results of mapping
/// `transform` over `self`.
///
/// - Complexity: O(*M* + *N*), where *M* is the length of `self`
/// and *N* is the length of the result.
public func flatMap<T>(@noescape transform: (Self.Generator.Element) -> T?) -> [T]
}