Skip to content

Instantly share code, notes, and snippets.

View mitchellporter's full-sized avatar

Mitchell Porter mitchellporter

  • Seattle, WA
View GitHub Profile
#Amazon Elastic Transcoder (ET)
#ET supports presets for transcoding
#http://docs.aws.amazon.com/elastictranscoder/latest/developerguide/preset-settings.html
//Let's put our video file to AWS S3. $region = "eu-west-1";
$folder = "source_videos/"; //init class to work with s3.
$s3 = new AmazonS3(); //get real file path
$real_video_file = str_replace(base_url(), ROOT, $some_file); //generate new unique video name
$unique_string = md5(uniqid() . time());
$video_file = $folder . $unique_string; //send out file to s3 storage
@mitchellporter
mitchellporter / AppDelegate.m
Created September 27, 2015 21:41 — forked from ericallam/AppDelegate.m
Interactive Animated Transition Example
//
// AppDelegate.m
// AnimationExamplesiPhone
//
// Created by Eric Allam on 10/05/2014.
#import "AppDelegate.h"
#pragma mark - UIColor Additions
var str = "Hello Swift!"
var aStr = "Hello World!"
str.startIndex // first index
str.endIndex // end index
str.startIndex.distanceTo(str.endIndex) // string length
str.characters.count // string length
str[str.startIndex.advancedBy(4)] // get character at index 4
@mitchellporter
mitchellporter / twilio_data.json
Created November 7, 2015 23:49 — forked from btoews/twilio_data.json
Country codes and Twilio deliverability rates
{
"Afghanistan": {
"country_code": "+93",
"deliverability_rate": 77
},
"Albania": {
"country_code": "+355"
},
"Algeria": {
"country_code": "+213",
@mitchellporter
mitchellporter / Podfile
Created November 29, 2015 21:16
Swift project's podfile
source 'https://github.com/CocoaPods/Specs.git'
use_frameworks!
link_with ‘MyAppName’
platform :ios, '8.0'
inhibit_all_warnings!
target ‘MyAppName’ do
pod 'Parse'
pod 'ParseFacebookUtilsV4'
pod 'Reveal-iOS-SDK', :configurations => ['Debug']
pod 'FBSDKCoreKit'
@mitchellporter
mitchellporter / MyButton.m
Created December 5, 2015 09:41 — forked from chrishulbert/MyButton.m
UIButton subclass
// How to subclass UIButton, given that it uses a static constructor so you can't override init.
@interface MyButton : UIButton
...
@end
@implementation MyButton
+ (instancetype)buttonWithType:(UIButtonType)buttonType {
MyButton *button = [super buttonWithType:buttonType];

Videos

@mitchellporter
mitchellporter / gist:586eff4ed9bdee23c40d
Created December 11, 2015 19:32 — forked from taylorhughes/gist:4dc50b2fe674c0a84cc6
Update Facebook token in iOS client from existing server-side cached token
[self.apiClient retrieveConnectedServicesWithSuccessBlock:^(NSDictionary *services) {
NSArray *facebookTokens = services[@"facebook"];
if (facebookTokens.count == 0) {
return;
}
NSDictionary *mostRecentFacebookTokenDict = facebookTokens[0];
NSNumber *refreshTimeNumber = mostRecentFacebookTokenDict[@"refreshTime"];
NSDate *refreshDate = [NSDate dateWithTimeIntervalSince1970:[refreshTimeNumber doubleValue]];
@mitchellporter
mitchellporter / gist:0b77466bfe6598ac6c12
Created January 9, 2016 06:43 — forked from bwhiteley/gist:049e4bede49e71a6d2e2
Initialize Swift subclass of UIView, designed in .xib
// Create CustomView.xib, set File's Owner to CustomView.
// Link the top level view in the XIB to the contentView outlet.
class CustomView : UIView {
@IBOutlet private var contentView:UIView?
// other outlets
override init(frame: CGRect) { // for using CustomView in code
super.init(frame: frame)
self.commonInit()
@mitchellporter
mitchellporter / ABSpringDemoViewController.m
Created January 11, 2016 04:05 — forked from samnm/ABSpringDemoViewController.m
A super-quick clone of Facebook Paper's springy table view
//
// ABSpringDemoViewController.m
// Springy
//
#import "ABSpringDemoViewController.h"
@interface ABSpringDemoViewController () <UITableViewDataSource, UITableViewDelegate> {
UITableView *_tableView;
CADisplayLink *_displayLink;