This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import AVFoundation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let queuePlayer = AVQueuePlayer() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let urlPath = NSBundle.mainBundle().pathForResource("your_file", ofType:"mp3") | |
let fileURL = NSURL(fileURLWithPath:urlPath!) | |
let playerItem = AVPlayerItem(URL:fileURL) | |
queuePlayer.insertItem(playerItem, afterItem:nil) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
queuePlayer.play() | |
queuePlayer.pause() | |
queuePlayer.removeItem(queuePlayer.currentItem) // skip current audio |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git log --pretty=oneline --abbrev-commit --since='yesterday' --author='Eliasz Sawicki' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git log --pretty=oneline --abbrev-commit --since='yesterday' --author='Eliasz Sawicki' | mail -s "Update" "eliasz.sawicki@gmail.com" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@interface Task : NSObject <NSCoding> | |
@property (nonatomic, strong) NSString *name; | |
- (instancetype)initWithName:(NSString *)name; | |
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@implementation Task | |
- (instancetype)initWithName:(NSString *)name { | |
self = [super init]; | |
if (self) { | |
self.name = name; | |
} | |
return self; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)saveTasks { | |
NSMutableArray *tasksToSave = [NSMutableArray new]; | |
for (NSInteger i = 0 ; i < 5; i ++) { | |
NSString *taskName = [NSString stringWithFormat:@"%d", arc4random_uniform(50)]; | |
Task *task = [[Task alloc] initWithName:taskName]; | |
[tasksToSave addObject:task]; | |
} | |
NSString *path = @"~/Documents/"; | |
path = [path stringByAppendingString:@"FILE_NAME"]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)loadTasks { | |
NSString *path = @"~/Documents/"; | |
path = [path stringByAppendingString:@"FILE_NAME"]; | |
path = [path stringByExpandingTildeInPath]; | |
NSMutableDictionary *rootObject = [NSKeyedUnarchiver unarchiveObjectWithFile:path]; | |
NSArray *tasks = rootObject[@"myTasks"]; | |
for (NSInteger i = 0; i < tasks.count; i++) { |
OlderNewer