Skip to content

Instantly share code, notes, and snippets.

View arielelkin's full-sized avatar

Ariel Elkin arielelkin

View GitHub Profile
@arielelkin
arielelkin / gist:2843907
Created May 31, 2012 14:48
Adding a loading wheel on top of some translucent shit
//You probably won't be able to use "self" in OF,
//so I'll let you figure out how to obtain the device's
//the width and height from OF
float screenWidth = self.view.frame.size.width;
float screenHeight = self.view.frame.size.height;
UIView *translucentShit = [[UIView alloc] initWithFrame:CGRectMake(0, 0, screenWidth, screenHeight)];
[translucentShit setBackgroundColor:[UIColor blackColor]];
@arielelkin
arielelkin / Recorder.h
Created June 14, 2012 22:04
SimpleAudioRecording
//
// Recorder.h
//
// Created by Ariel Elkin on 14/05/2012.
//
#import <Foundation/Foundation.h>
#import <AVFoundation/AVFoundation.h>
@interface NarrationManager : NSObject
@arielelkin
arielelkin / Navigator.m
Created June 26, 2012 16:15
Navigation with a huge memory footpring
@implementation CBNavigator
int currentPage = -1;
-(void)viewDidAppear:(BOOL)animated{
NSLog(@"Navigator appeared");
if(currentPage == -1){
currentPage++;
UIViewController *nextPageVC = [self.storyboard instantiateViewControllerWithIdentifier:[NSString stringWithFormat:@"%d", currentPage ]];
[self presentModalViewController:nextPageVC animated:YES];
@arielelkin
arielelkin / UnzipEmbeddedPack.m
Created June 29, 2012 10:02
unzipping an embedded tune pack
-(void)unzipEmbeddedPack{
NSString *embeddedPackPath = [NSString stringWithFormat:@"%@/packName.zip", [[NSBundle mainBundle] resourcePath]];
ZipArchive *za = [[ZipArchive alloc] init];
[za UnzipOpenFile:embeddedPackPath Password:@"abf26a4849e5d97882fcdce5757ae6028281192a"];
//make sure to unzip to tune packs on disk
NSError *deleteError = nil;
[[NSFileManager defaultManager] removeItemAtPath:embeddedPackPath error:&deleteError];
if(deleteError != nil) NSLog(@"error deleting: %@", deleteError);
@arielelkin
arielelkin / SegueSlideFromTop.m
Created July 30, 2012 11:35
Custom Segue to slide a view controller from the top
-(void)perform{
UIViewController *splashScreen = self.sourceViewController;
UIViewController *mainScreen = self.destinationViewController;
[splashScreen.view addSubview:mainScreen.view];
mainScreen.view.center = CGPointMake(mainScreen.view.center.x, mainScreen.view.center.y-600);
[UIView animateWithDuration:1
@arielelkin
arielelkin / DonutSlice.m
Created November 14, 2012 17:45
Animating Slice of Donut
float radius = 300;
CAShapeLayer *donut = [CAShapeLayer layer];
donut.bounds = CGRectMake(0,0,radius, radius);
donut.cornerRadius = radius/2;
donut.borderWidth = 2;
donut.borderColor = [UIColor redColor].CGColor;
[self.layer addSublayer:donut];
@arielelkin
arielelkin / AAE+STKGists.m
Last active December 17, 2015 11:18
AAE+STK Gists
//NOTE:
//THIS GIST IS PART OF A LARGER iOS MUSIC APP DEVELOPMENT TUTORIAL, WHICH I'LL POST SHORTLY.
//Follow http://twitter.com/arivocals for updates
/***************************
DOWNLOAD LINKS FOR LIBRARIES:
STK:
http://momu.stanford.edu/stk/release/momu-stk-1.0.0.tgz
@arielelkin
arielelkin / createVenuesDict.m
Last active December 18, 2015 03:29
LocoQuizz functions
-(void)createVenuesDict:(NSArray *)allVenues{
venuesDict = [NSMutableDictionary dictionary];
//Only get the venues' names and categories
for(NSDictionary *singleVenue in allVenues){
NSArray *categories = [singleVenue valueForKey:@"categories"];
if(categories){
[self.venuesDict setValue:[categories valueForKey:@"name"][0] forKey:[singleVenue valueForKey:@"name"]];
}
@arielelkin
arielelkin / gist:0c974b2d81f9f4e5f4f5
Last active November 20, 2015 13:55
Compile nginx standalone without root access
# Compile nginx standalone without root access
mkdir ~/installed
mkdir ~/installed/nginx
mkdir ~/src
cd ~/src
wasup wasup
# Grab nginx
wget http://sysoev.ru/nginx/nginx-0.7.50.tar.gz