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 / curl.sh
Created May 17, 2016 22:55 — forked from davimacedo/curl.sh
Example of importing data with cloud functions
curl -X POST \
-H "X-Parse-Application-Id: LL9oIdzIkmwl5xyowQQu0fTmXyUWfet9RuAzwHfj" \
-H "X-Parse-REST-API-Key: R3S8PYQKuzeV4c8MUeO5ved46C50MEp56boDHW1O" \
-H "Content-Type: application/json" \
-d @data.json \
https://parseapi.back4app.com/functions/import
@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];
@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:624391a7c86280cb4472
Created March 29, 2016 00:19 — forked from uhw76tgwquerhjbqwnejk/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 / IAPHelper.txt
Created March 19, 2016 23:25 — forked from speaktoalvin/IAPHelper.txt
In App Purchase in Swift, with Receipt Validation
import UIKit
import StoreKit
//MARK: SKProductsRequestDelegate
extension IAPHelpers : SKProductsRequestDelegate
{
func productsRequest(request: SKProductsRequest, didReceiveResponse response: SKProductsResponse)
{
@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',
// 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 / 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;
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 / 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