Skip to content

Instantly share code, notes, and snippets.

View saiday's full-sized avatar
:shipit:
su su su

Saiday saiday

:shipit:
su su su
View GitHub Profile
@saiday
saiday / Installing LAME on Mac OSX Lion
Last active September 13, 2015 11:44 — forked from trevorsheridan/Installing LAME on Mac OSX Lion
Installing LAME on Mac OSX Lion
Getting the Source
$ cd ~/source
$ curl -L -O http://downloads.sourceforge.net/project/lame/lame/3.99/lame-3.99.5.tar.gz
$ tar -zxvf lame-3.99.5.tar.gz
$ rm -r lame-3.99.5.tar.gz
$ cd lame-3.99.5
Installing
$ ./configure
$ make
@saiday
saiday / gist:bc458ec177fd7da02fec
Last active September 13, 2015 11:15
Delete Xcode blacklist bundles (accidentally choose skip bundle)
defaults delete com.apple.dt.Xcode DVTPlugInManagerNonApplePlugIns-Xcode-{XcodeVersion}
@saiday
saiday / pattern-examples.swift
Last active September 6, 2015 13:02 — forked from terhechte/pattern-examples.swift
Swift pattern examples for the swift, for, and guard keywords
import Foundation
// 1. Wildcard Pattern
func wildcard(a: String?) -> Bool {
guard case _? = a else { return false }
for case _? in [a] {
return true
}
@saiday
saiday / variable_capture.py
Created July 29, 2015 18:12
Python variable capture
a = [lambda: i for i in xrange(1, 4)]
for f in a:
print f()
//output: 333
@saiday
saiday / variable_capture.rb
Created July 29, 2015 18:08
Ruby variable capture
a = []
for i in 1..3
a.push(lambda { i })
end
for f in a
print "#{f.call()}"
end
// output: 333
@saiday
saiday / gist:e8ea1a5165ca469baee4
Created July 14, 2015 07:59
Update UICollectionView with animation
- (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator
{
[super viewWillTransitionToSize:size withTransitionCoordinator:coordinator];
[coordinator animateAlongsideTransition:nil completion:^(id<UIViewControllerTransitionCoordinatorContext> context) {
[self.collectionView performBatchUpdates:^{
[self.collectionView setCollectionViewLayout:self.collectionView.collectionViewLayout animated:YES];
} completion:nil];
}];
}
NextViewController *newVC = [[NextViewController alloc] init];
newVC.transitioningDelegate = self;
newVC.modalTransitionStyle = UIModalPresentationCustom;
[self presentViewController:newVC animated:YES completion:nil];
@saiday
saiday / ExistViewController.m
Last active November 19, 2015 09:47
ExistViewController
- (void)viewDidLoad
{
[super viewDidLoad];
self.presentInteractor = [[MiniToLargeViewInteractive alloc] init];
[self.presentInteractor attachToViewController:self withView:self.miniView presentViewController:self.playerView];
self.dismissInteractor = [[MiniToLargeViewInteractive alloc] init];
[self.dismissInteractor attachToViewController:self.nextViewController withView:self.nextViewController.view presentViewController:nil];
}
@saiday
saiday / MiniToLargeViewInteractive.m
Last active November 19, 2015 08:34
MiniToLargeViewInteractive
#import "MiniToLargeViewInteractive.h"
@interface MiniToLargeViewInteractive ()
@property (nonatomic) BOOL shouldComplete;
@end
@implementation MiniToLargeViewInteractive
@saiday
saiday / MiniToLargeViewInteractive.h
Created June 15, 2015 13:18
MiniToLargePlayerInteractive
#import <UIKit/UIKit.h>
@interface MiniToLargeViewInteractive : UIPercentDrivenInteractiveTransition
@property (nonatomic) UIViewController *viewController;
@property (nonatomic) UIViewController *presentViewController;
@property (nonatomic) UIPanGestureRecognizer *pan;
- (void)attachToViewController:(UIViewController *)viewController withView:(UIView *)view presentViewController:(UIViewController *)presentViewController;
@end