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 / 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).

@mitchellporter
mitchellporter / tinder-api-documentation.md
Created February 29, 2016 04:55 — forked from rtt/tinder-api-documentation.md
Tinder API Documentation

Tinder API documentation

http://rsty.org/

I've sniffed most of the Tinder API to see how it works. You can use this to create bots (etc) very trivially. Some example python bot code is here -> https://gist.github.com/rtt/5a2e0cfa638c938cca59 (horribly quick and dirty, you've been warned!)

Note: this was written in April/May 2014 and the API may have changed since. I have nothing to do with Tinder, nor their API, and I do not offer any support for anything you may build on top of this

API Details

import UIKit
/*
I'm not sure why `@NSCopying` doesn't seem to be copying the object in the example below.
I'm attempting to write code that follows the "initialization with a configuration object" pattern, like `NSURLSession`.
Ideally the configuration would be a struct, but since I'm still interoperating with Obj-C that's not an option.
*/
class Foo : NSObject, NSCopying {
var bar = "bar"
@mitchellporter
mitchellporter / DismissGravity.h
Created March 9, 2016 17:55 — forked from andkon/DismissGravity.h
Animated transitions and UIKit Dynamics
@interface DismissGravity : NSObject <UIViewControllerAnimatedTransitioning>
@property (strong, nonatomic) UIDynamicAnimator *animator;
// the cell creation logic
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
UVLVideoCell *videoCell = (UVLVideoCell *)[collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([UVLVideoCell class]) forIndexPath:indexPath];
NSInteger index = 1 + indexPath.item%2;
NSURL *sampleURL = [[NSBundle mainBundle] URLForResource:[NSString stringWithFormat:@"flak_0%i", index] withExtension:@"mp4" subdirectory:@"videos"];
[videoCell loadVideoURL:sampleURL];
return videoCell;
@mitchellporter
mitchellporter / gist:d8e9384a208fdc0e5bad
Created March 17, 2016 04:31
parse cloud function for validating itunes sandbox receipt data
Parse.Cloud.define("verifyReceipt", function(request, response) {
var validationParams = {"receipt-data": request.params.receipt }
Parse.Cloud.httpRequest({
method: 'POST',
headers: {
'Content-Type': 'application/json;charset=utf-8',
},
url: 'https://sandbox.itunes.apple.com/verifyReceipt',
@mitchellporter
mitchellporter / gist:624391a7c86280cb4472
Created March 29, 2016 00:19 — forked from JoeyBodnar/gist:7be323b066058667851b
Video Loading/Caching with AVAssetResourceLoader
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
VideoCell *videoCell = (VideoCell *)[self.tableView dequeueReusableCellWithIdentifier:@"VideoCell"];
NSString *urlString = @"streaming://download.wavetlan.com/SVV/Media/HTTP/MOV/ConvertedFiles/MediaCoder/MediaCoder_test11_36s_H263_VBR_590kbps_176x144_25fps_MPEG1Layer3_CBR_160kbps_Stereo_22050Hz.mov";
dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0ul);
// Configure Video Cell Here:
NSURL *url = [NSURL URLWithString:urlString];
videoCell.contentView.backgroundColor = [UIColor clearColor];
videoCell.backgroundColor = [UIColor clearColor];
@mitchellporter
mitchellporter / testflight-user.swift
Created April 8, 2016 23:59
Detect if TestFlight user
Objective-C:
[[[[NSBundle mainBundle] appStoreReceiptURL] lastPathComponent] isEqualToString:@"sandboxReceipt"]
Swift:
NSBundle.mainBundle().appStoreReceiptURL?.lastPathComponent == "sandboxReceipt"
@mitchellporter
mitchellporter / gist:69036d0b3fb74493caeb25e09fbcd74e
Created April 19, 2016 05:37 — forked from oliland/gist:5416438
An example of using CIFilters to mess with UIViews on iOS.
- (void)viewDidLoad
{
[super viewDidLoad];
// Great tutorial: http://www.raywenderlich.com/22167/beginning-core-image-in-ios-6
// Official docs: https://developer.apple.com/library/ios/#documentation/GraphicsImaging/Conceptual/CoreImaging/ci_intro/ci_intro.html#//apple_ref/doc/uid/TP30001185-CH1-TPXREF101
// Alt-click on function names for more!
// Make any old label, with our frame set to the view so we know it's there.
UILabel *label = [[UILabel alloc] initWithFrame:self.view.frame];