Skip to content

Instantly share code, notes, and snippets.

Avatar

Ariel Elkin arielelkin

View GitHub Profile
View isNullOrEmpty.swift
protocol StringType {
var isEmpty: Bool { get }
}
extension String : StringType { }
extension Optional where Wrapped: StringType {
var isNullOrEmpty: Bool {
return self?.isEmpty ?? true
}
@arielelkin
arielelkin / ffmpeg.md
Created Dec 8, 2018 — forked from protrolium/ffmpeg.md
using ffmpeg to extract audio from video files
View ffmpeg.md

ffmpeg

Converting Audio into Different Formats / Sample Rates

Minimal example: transcode from MP3 to WMA:
ffmpeg -i input.mp3 output.wma

You can get the list of supported formats with:
ffmpeg -formats

Convert WAV to MP3, mix down to mono (use 1 audio channel), set bit rate to 64 kbps and sample rate to 22050 Hz:

@arielelkin
arielelkin / horrible-storyboard.md
Created Jul 25, 2018 — forked from iraycd/horrible-storyboard.md
Bad Experiences with Storyboard.
View horrible-storyboard.md

Interestingly Apple doesn't even use Storyboards in their recently open-sourced ResearchKit as [Peter Steinberger has noticed][1] (under the subheading "Interface Builder").

As expected, Apple keeps improving Storyboards and Xcode. Some of the points that applied to iOS 7 and below don't apply to iOS 8 anymore (and are now marked as such). So while Storyboards inherently still have flaws, I revise my advice from don't use to selectively use where it makes sense.

Even now that iOS 7 is out, I would advise against to use caution when deciding whether to use Storyboards. Here are my reasons:

  • Storyboards fail at runtime, not at compile time: You have a typo in a segue name or connected it wrong in your storyboard? It will blow up at runtime. You use a custom UIViewController subclass that doesn't exist anymore in your storyboard? It will blow up at runtime. If you do such things in code, you will catch them early on, during compile time. Update: My new tool **[StoryboardLin
@arielelkin
arielelkin / snowden-ietf93.md
Created Apr 5, 2018 — forked from mnot/snowden-ietf93.md
Transcript of Edward Snowden's comments at IETF93.
View snowden-ietf93.md
View trolling_haskell
13:15 <xQuasar> | HASKELL IS FOR FUCKIN FAGGOTS. YOU'RE ALL A BUNCH OF
| FUCKIN PUSSIES
13:15 <xQuasar> | JAVASCRIPT FOR LIFE FAGS
13:16 <luite> | hello
13:16 <ChongLi> | somebody has a mental illness!
13:16 <merijn> | Wow...I suddenly see the error of my ways and feel
| compelled to write Node.js!
13:16 <genisage> | hi
13:16 <luite> | you might be pleased to learn that you can compile
| haskell to javascript now
@arielelkin
arielelkin / gist:0c974b2d81f9f4e5f4f5
Last active Nov 20, 2015
Compile nginx standalone without root access
View gist:0c974b2d81f9f4e5f4f5
# 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
@arielelkin
arielelkin / createVenuesDict.m
Last active Dec 18, 2015
LocoQuizz functions
View createVenuesDict.m
-(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"]];
}
View AAE+STKGists.m
//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 / DonutSlice.m
Created Nov 14, 2012
Animating Slice of Donut
View DonutSlice.m
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];