Skip to content

Instantly share code, notes, and snippets.

@mattyohe
mattyohe / dVZWRkRSYjg2QWdKaDZ2UWphSUhFUT09
Created August 6, 2021 17:09
dVZWRkRSYjg2QWdKaDZ2UWphSUhFUT09
dVZWRkRSYjg2QWdKaDZ2UWphSUhFUT09
@mattyohe
mattyohe / Makefile
Created April 19, 2017 00:35
Partial Makefile that resolves random Error 65 issues on circle (and travis?)
.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
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 February 24, 2016 20:43
What is the output?

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 October 29, 2015 04:04 — forked from nlutsenko/.travis.yml
Make Travis-CI run your tests using different versions of Xcode
os: osx
matrix:
include:
- osx_image: xcode7.0
- osx_image: xcode7.1
- osx_image: xcode7.2b1
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 September 25, 2015 19:36 — 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…
// 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 March 10, 2015 21:57
uncompiled swift code (probably has errors!)
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 August 29, 2015 14:14
This will crash kexmex!
- (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];
#import <UIKit/UIKit.h>
@interface UIScrollView (KeyboardInsets)
- (void)addInsetsForKeyboardHandlers;
- (void)removeInsetsForKeyboardHandlers;
@end