Skip to content

Instantly share code, notes, and snippets.

View martinpilch's full-sized avatar

Martin Pilch martinpilch

View GitHub Profile
@martinpilch
martinpilch / UIView+CornersRoundable.swift
Last active May 28, 2020 08:03
Rounded corners for UIView in modern way
import UIKit
extension CACornerMask {
static var noCorners: CACornerMask { return [] }
static var topLeftCorner: CACornerMask { return .layerMinXMinYCorner }
static var topRightCorner: CACornerMask { return .layerMaxXMinYCorner }
static var bottomLeftCorner: CACornerMask { return .layerMinXMaxYCorner }
static var bottomRightCorner: CACornerMask { return .layerMaxXMaxYCorner }
@martinpilch
martinpilch / onAppOpenAttribution.swift
Created October 23, 2018 09:23
Content of onAppOpenAttribution function
func onAppOpenAttribution(_ attributionData: [AnyHashable: Any]) {
// If opening app from onelink shortlink we check for `af_dp` property
if let deeplink = attributionData[Keys.deeplink] as? String,
let deeplinkURL = URL(string: deeplink) {
delegate?.setDeeplinkURL(deeplinkURL)
return
}
// Else we get `link` property and and parse it's params
@martinpilch
martinpilch / gist:6010712
Created July 16, 2013 17:22
AutoLayout - image view width
constraints = [NSLayoutConstraint constraintsWithVisualFormat:@"H:|-8-[_spotNameLabel(<=140)]"
options:NSLayoutFormatAlignAllBaseline
metrics:nil
views:viewsDictionary];
constraints = [NSLayoutConstraint constraintsWithVisualFormat:@"H:|-0-[_spotNameSeparator(==_spotNameLabel)]"
options:NSLayoutFormatAlignAllBaseline
metrics:nil
views:viewsDictionary];
@martinpilch
martinpilch / TMViewDeckController.h
Created April 29, 2013 19:30
Simple controller to present Path like sliding controllers
//
// TMViewDeckController.h
//
// Created by Martin Pilch on 4/25/13.
// Copyright (c) 2013 Martin Pilch. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface TMViewDeckController : UIViewController
@martinpilch
martinpilch / UIImageView+DownloadProgress.h
Created March 29, 2013 08:37
Simple UIImageView category to get download progress by extenging UIImageView+AFNetworking.h category
//
// UIImageView+DownloadProgress.h
//
//
// Created by Martin Pilch on 3/29/13.
//
//
#import "UIImageView+AFNetworking.h"
@martinpilch
martinpilch / AppDelegate.m
Last active October 12, 2015 10:08
AirPlay video mirroring
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
//... Initialization of application
//Screen notification handlers
NSNotificationCenter *center = [NSNotificationCenter defaultCenter];
[center addObserver:self selector:@selector(handleScreenDidConnectNotification:)
name:UIScreenDidConnectNotification object:nil];
[center addObserver:self selector:@selector(handleScreenDidDisconnectNotification:)
name:UIScreenDidDisconnectNotification object:nil];
[dictionary putStringValue:@"facebook" forKey:@"provider"];
[dictionary putStringValue:@"109322029116699" forKey:@"facebookAppId"];
[dictionary putStringValue:@"tw4" forKey:@"facebookLocalAppId"];
[dictionary putStringValue:@"email,user_birthday,user_location,publish_stream,offline_access" forKey:@"facebookExtraPermissions"];
GSObject *dictionary = [[[GSObject alloc] init] autorelease];
[dictionary putStringValue:@"facebook" forKey:@"provider"];
[dictionary putStringValue:@"109322029116699" forKey:@"facebookAppId"];
[dictionary putStringValue:@"tw4" forKey:@"facebookLocalAppId"];
[dictionary putStringValue:@"email,user_birthday,user_location,publish_stream,offline_access" forKey:@"facebookExtraPermissions"];
@martinpilch
martinpilch / MPActivityIndicator.h
Created May 31, 2012 18:33
Custom activity indicator
@interface MPActivityIndicator : UIView
@property (nonatomic, readonly, getter = isAnimating) BOOL animating;
- (void)stopAnimating;
- (void)startAnimating;
- (void)rotateLoadingCircleByPercents:(CGFloat)percents;
@end
{
data = {
clips = (
{
"clip_board_ids" = (
7925
);
creator = {
id = 823408;
name = "Martin Pilch";