Skip to content

Instantly share code, notes, and snippets.

Matt Yohe mattyohe

Block or report user

Report or block mattyohe

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@mattyohe
mattyohe / Makefile
Created Apr 19, 2017
Partial Makefile that resolves random Error 65 issues on circle (and travis?)
View Makefile
.PHONY: _build
_build:
set -o pipefail && \
xcodebuild build -workspace $(WORKSPACE).xcworkspace -scheme $(SCHEME) \
-sdk $(SDK) -destination $(DESTINATION) \
CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY= 2>&1 | \
tee $(CIRCLE_ARTIFACTS)/xcode_raw_build.log | \
xcpretty --color
.PHONY: _test
View Speech
My parents impressed on me the value of that you work hard for what you want in life. That your word is your bond and you do what you say and keep your promise. That you treat people with respect. Show the values and morals in in the daily life. That is the lesson that we continue to pass on to our son.
We need to pass those lessons on to the many generations to follow. [Cheering] Because we want our children in these nations to know that the only limit to your achievement is the strength of your dreams and your willingness to work for them.
@mattyohe
mattyohe / output.md
Created Feb 24, 2016
What is the output?
View output.md

Given:

let maybeNumbers: [Int?] = [1,2,3,nil,5]
let numbers = maybeNumbers.flatMap { $0 }
print(numbers)
=> [1, 2, 3, 5]

Where flatMap on a SequenceType is said to: Return an Array containing the non-nil results of mapping transform over self. - cite

@mattyohe
mattyohe / .travis.yml
Created Oct 29, 2015 — forked from nlutsenko/.travis.yml
Make Travis-CI run your tests using different versions of Xcode
View .travis.yml
os: osx
matrix:
include:
- osx_image: xcode7.0
- osx_image: xcode7.1
- osx_image: xcode7.2b1
View bad_date_formatter.swift
func badDateFormatter(date: NSDate) -> String {
let formatter = NSDateFormatter()
formatter.dateFormat = "YYYY"
return formatter.stringFromDate(date)
}
func christmasUTCWithOffset(offset: Int) -> NSDate {
return NSDate(timeIntervalSince1970: 1451001600 + (Double(offset) * 86400.0))
}
@mattyohe
mattyohe / PSPDFUIKitMainThreadGuard.m
Created Sep 25, 2015 — forked from steipete/PSPDFUIKitMainThreadGuard.m
This is a guard that tracks down UIKit access on threads other than main. This snippet is taken from the commercial iOS PDF framework http://pspdfkit.com, but relicensed under MIT. Works because a lot of calls internally call setNeedsDisplay or setNeedsLayout. Won't catch everything, but it's very lightweight and usually does the job.You might n…
View PSPDFUIKitMainThreadGuard.m
// Taken from the commercial iOS PDF framework http://pspdfkit.com.
// Copyright (c) 2014 Peter Steinberger, PSPDFKit GmbH. All rights reserved.
// Licensed under MIT (http://opensource.org/licenses/MIT)
//
// You should only use this in debug builds. It doesn't use private API, but I wouldn't ship it.
#import <objc/runtime.h>
#import <objc/message.h>
// Compile-time selector checks.
@mattyohe
mattyohe / gist:4f685131b0674e4354c4
Created Mar 10, 2015
uncompiled swift code (probably has errors!)
View gist:4f685131b0674e4354c4
class PlayerView : UIView {
var player: AVPlayer {
get{
var layer = self.layer as AVPlayerLayer
return layer.player
}
set {
var layer: AVPlayerLayer = self.layer as AVPlayerLayer
layer.player = newValue
@mattyohe
mattyohe / gist:3d3fb08cb29e459a7442
Last active Aug 29, 2015
This will crash kexmex!
View gist:3d3fb08cb29e459a7442
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
[self addObserver:self forKeyPath:@"DERP" options:NSKeyValueObservingOptionNew context:nil];
}
- (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
View UIScrollView+KeyboardInsets.h
#import <UIKit/UIKit.h>
@interface UIScrollView (KeyboardInsets)
- (void)addInsetsForKeyboardHandlers;
- (void)removeInsetsForKeyboardHandlers;
@end
@mattyohe
mattyohe / gist:1755ae10470ee215bb30
Created Dec 8, 2014
UIScrollView UIButton allow scrolling
View gist:1755ae10470ee215bb30
- (BOOL)touchesShouldCancelInContentView:(UIView *)view
{
if ( [view isKindOfClass:[UIButton class]] ) {
return YES;
}
return [super touchesShouldCancelInContentView:view];
}
You can’t perform that action at this time.