Skip to content

Instantly share code, notes, and snippets.

View mglagola's full-sized avatar

Mark Glagola mglagola

View GitHub Profile
@mglagola
mglagola / RACSignal+Animation.h
Last active June 30, 2016 06:26
RACSignal+Animation
@interface RACSignal (ViewAnimations)
- (RACSignal *)animateWithDuration:(NSTimeInterval)duration;
- (RACSignal *)animateWithDuration:(NSTimeInterval)duration usingSpringWithDamping:(CGFloat)dampingRatio initialSpringVelocity:(CGFloat)velocity;
- (RACSignal *)animateWithDuration:(NSTimeInterval)duration delay:(NSTimeInterval)delay usingSpringWithDamping:(CGFloat)dampingRatio initialSpringVelocity:(CGFloat)velocity;
- (RACSignal *)animateWithDuration:(NSTimeInterval)duration delay:(NSTimeInterval)delay usingSpringWithDamping:(CGFloat)dampingRatio initialSpringVelocity:(CGFloat)velocity options:(UIViewAnimationOptions)options;
@mglagola
mglagola / SpinnerButton.h
Last active August 29, 2015 14:24
Spinner Button
//
// SpinnerButton.h
//
//
// Created by Mark Glagola.
// Copyright (c) 2015 Mark Glagola. All rights reserved.
//
#import <UIKit/UIKit.h>
#import <ReactiveCocoa/ReactiveCocoa.h>
_currentAccount =
[[RACSignal
combineLatest:@[_loadStateEvents,
[_selectedAccountIDSignal startWith:nil],
[_additionalAccountsSignal startWith:nil]]
reduce:^id (STAccountManagerLoadStateEvent *event, NSNumber *selectedID, NSArray *additionalAccounts) {
@strongify(self);
switch (event.state) {
case kSTAccountLoadStateLoaded: {
Error Domain=com.alamofire.error.serialization.response Code=-1011 "Request failed: not found (404)" UserInfo=0x1740ff180 {com.alamofire.serialization.response.error.response=<NSHTTPURLResponse: 0x170a30260> { URL: https://api.stagebloc.com/v1/account/5212/photo } { status code: 404, headers {
"Cache-Control" = "no-cache";
"Content-Length" = 130;
"Content-Type" = "application/json";
Date = "Tue, 20 Jan 2015 18:15:31 GMT";
Server = "Apache/2.2.22 (Ubuntu)";
Vary = Authorization;
"X-Powered-By" = "PHP/5.4.36-1+deb.sury.org~precise+2";
} }, SBAPIErrorResponseObjectKey=<CFBasicHash 0x176269c80 [0x194a32c80]>{type = immutable dict, count = 2,
entries =>
@mglagola
mglagola / CollectionViewFlowLayout.swift
Last active August 29, 2015 14:08
Physics based collection view
//
// CollectionViewFlowLayout.swift
// Github
//
// Created by Mark Glagola on 10/30/14.
// Copyright (c) 2014 Mark Glagola. All rights reserved.
//
import UIKit
@mglagola
mglagola / colors.xml
Last active August 29, 2015 14:06
Flat UI Colors for Android (http://flatuicolors.com/)
<?xml version="1.0" encoding="utf-8"?>
<resources>
//greenish-blueish
<color name="flat_turquoise">#1abc9c</color>
<color name="flat_green_sea">#16a085</color>
//greenish
<color name="flat_emerald">#2ecc71</color>
<color name="flat_nephritis">#27ae60</color>
@mglagola
mglagola / BareTabBarController.m
Last active August 29, 2015 14:04
Custom [Bare] TabBarController class built over UIViewController snippet.
@interface BareTabBarController : UIViewController
extern CGFloat const kBareDefaultSelectedIndexAnimationDuration;
@property (nonatomic, copy) NSArray *viewControllers;
@property (nonatomic, weak) UIViewController *selectedViewController;
@property (nonatomic) NSUInteger selectedIndex;
@property (nonatomic, readonly) CGFloat padding; //set in setViewControllers:padding:
@mglagola
mglagola / TableViewController+FRC.m
Last active December 19, 2015 22:39
TableViewController + FRC Snippet
//change SomeFRCControllerClass to whatever
@interface SomeControllerClass : UIViewController <UITableViewDataSource, NSFetchedResultsControllerDelegate>
@property (nonatomic) NSFetchedResultsController *fetchedResultsController;
@property (nonatomic) UITableView *tableView;
@end
@implementation SomeFRCControllerClass //replace with desired name