Skip to content

Instantly share code, notes, and snippets.

View mitchellporter's full-sized avatar

Mitchell Porter mitchellporter

  • Seattle, WA
View GitHub Profile
@mitchellporter
mitchellporter / Angle.swift
Last active August 29, 2015 06:10
Angle.swift
// Playground - noun: a place where people can play
import Foundation
func DegreesToRadians (value:Double) -> Double {
return value * M_PI / 180.0
}
func RadiansToDegrees (value:Double) -> Double {
return value * 180.0 / M_PI
@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
@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 / 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;
@mitchellporter
mitchellporter / gist:cc8537a1c8391aedec81
Created January 19, 2016 00:19 — forked from yoshimin/gist:670e2d551cb9afcd8cd4
AVPlayerで動画を再生
// サンプル動画のパスを取得
let bundle = NSBundle.mainBundle()
let url: NSURL = NSBundle.mainBundle().URLForResource("sample", withExtension: "mp4")!
// 動画のパスを指定してplayerItemを生成
self.playerItem = AVPlayerItem(URL: url)
// 上で生成したplayerItemを指定してplayerを生成
self.videoPlayer = AVPlayer(playerItem: self.playerItem)
@mitchellporter
mitchellporter / parse_aws.md
Created February 23, 2016 07:04 — forked from hassy/parse_aws.md
Deploying Parse Server on AWS (WIP)

Deploying Parse Server on AWS

Note: this is a work-in-progress and will be updated with more information over the next few days.

Intro

This guide will walk you through deploying your own instance of the open-source Parse Server. This would be a good starting point for testing your existing application to see if the functionality provided by the server is enough for your application, and to potentially plan your migration off the Parse Platform.

This guide will walk you through using Elastic Beanstalk (EB), which is an AWS service similar to Heroku. Why use EB rather than Heroku? Elastic Beanstalk does not lock you into Heroku-specific ways of doing things, is likely cheaper to run your backend on than Heroku, and it integrates with other services that AWS offer (and they offer almost everything one needs to run an application these days).