Skip to content

Instantly share code, notes, and snippets.

View exce11ent's full-sized avatar

Vitalii Kraiovyi exce11ent

  • Україна
View GitHub Profile
@exce11ent
exce11ent / Demo
Created September 26, 2013 16:27
-(CGFloat)tableView:(UITableView*)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
if (indexPath.section == SectionNumberInfo)
{
NSString *str = _group.groupDescription;
CGSize labelSize = [str sizeWithFont:[UIFont fontWithName:@"Helvetica" size:17] constrainedToSize:CGSizeMake(260, 400) lineBreakMode:NSLineBreakByTruncatingTail];
// 112 (logo height) + 13(logo to margin) + 8(logo bottom margin) + 40(label bottom margin) = 173
CGFloat result = 173 + labelSize.height;
@exce11ent
exce11ent / Fix scrollView content offset after push segue
Created September 25, 2013 16:02
Fix scrollView's content offset after push segue
- (void)viewDidLayoutSubviews {
[super viewDidLayoutSubviews];
_scrollView.contentOffset = _lastOffset;
}
-(void)viewDidDisappear:(BOOL)animated
{
[self unregisterForKeyboardNotifications];
_lastOffset = _scrollView.contentOffset;
_scrollView.contentOffset = CGPointZero;
@exce11ent
exce11ent / Merge two videos
Last active August 3, 2017 06:48
Merge two videos using AVFoundation ios
AVMutableComposition* mixComposition = [[AVMutableComposition alloc] init];
NSString *path1 = _exportPaths[0];
NSString *path2 = _exportPaths[1];
//load assets
AVURLAsset *asset1 = [AVURLAsset URLAssetWithURL:[NSURL fileURLWithPath:path1] options:nil];
AVURLAsset *asset2 = [AVURLAsset URLAssetWithURL:[NSURL fileURLWithPath:path2] options:nil];
//create mutable composition track and add all assets to this track
AVMutableCompositionTrack *track = [mixComposition addMutableTrackWithMediaType:AVMediaTypeVideo preferredTrackID:kCMPersistentTrackID_Invalid];
pbcopy < ~/.ssh/id_rsa.pub
// move item to clip marker
// save current touch.x as N
// if continue:
// calculate displacement from N point
// if displacement > threshold
// move item.center to current touch point;
// reset N;
NSString *numberString = @"0";
NSNumber *number = [NSNumber numberWithInt:_selectedCounter];
numberString = [numberString stringByAppendingString:number.description];
cell.numberLabel.text = numberString;
cell.numberLabel.hidden = NO;
// See http://mindsea.com/2012/12/18/downscaling-huge-alassets-without-fear-of-sigkill for details
#import <AssetsLibrary/AssetsLibrary.h>
#import <ImageIO/ImageIO.h>
// Helper methods for thumbnailForAsset:maxPixelSize:
static size_t getAssetBytesCallback(void *info, void *buffer, off_t position, size_t count) {
ALAssetRepresentation *rep = (__bridge id)info;
NSError *error = nil;