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
{
data = {
clips = (
{
"clip_board_ids" = (
7925
);
creator = {
id = 823408;
name = "Martin Pilch";
<head>
<!-- iOS -->
<meta property="al:ios:url" content="ztory://view/magazines" />
<meta property="al:ios:app_store_id" content="647302038" />
<meta property="al:ios:app_name" content="Ztory" />
<!-- Android -->
<meta property="al:android:url" content="ztory://view/magazines">
<meta property="al:android:package" content="com.ztory.main">
<meta property="al:android:app_name" content="Ztory">
<!-- Other headers -->
* Tracktivity : TRSignInInfoCell.m
*
* Copyright (c) 2013, Tapmates s.r.o. (www.tapmates.com).
* Created by martin pilch on 08/07/14.
*
* All rights reserved. This source code can be used only for purposes specified
* by the given license contract signed by the rightful deputy of Tapmates s.r.o.
* This source code can be used only by the owner of the license.
*
* Any disputes arising in respect of this agreement (license) shall be brought
@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];
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"];