Skip to content

Instantly share code, notes, and snippets.

View mkj-is's full-sized avatar
📱
Building iOS apps

Matěj Kašpar Jirásek mkj-is

📱
Building iOS apps
View GitHub Profile
@mkj-is
mkj-is / PathsToLayers.swift
Last active January 16, 2017 16:04
Bezier path to shape layers
let paths = [thPath, ePath, fuPath, nPath, tPath, aPath, sPath, t2Path, yPath]
let layers = paths.map { path -> CAShapeLayer in
let layer = CAShapeLayer()
layer.path = path.cgPath
layer.strokeEnd = 0
layer.strokeColor = UIColor.white.cgColor
layer.lineWidth = 1
layer.fillColor = UIColor.clear.cgColor
return layer
}
@mkj-is
mkj-is / AddLinearAnimation.swift
Last active January 16, 2017 16:04
Adding linear animation to shape layer
// Create shape layer and add the path to it
let layer = CAShapeLayer()
layer.path = path.cgPath
// Set up the appearance of the shape layer
layer.strokeEnd = 0
layer.lineWidth = 1
layer.strokeColor = UIColor.black.cgColor
layer.fillColor = UIColor.clear.cgColor
@mkj-is
mkj-is / AppleLogoBezier.swift
Last active February 9, 2024 04:47
Apple logo bezier path
let path = UIBezierPath()
// Apple
path.move(to: CGPoint(x: 110.89, y: 99.2))
path.addCurve(to: CGPoint(x: 105.97, y: 108.09), controlPoint1: CGPoint(x: 109.5, y: 102.41), controlPoint2: CGPoint(x: 107.87, y: 105.37))
path.addCurve(to: CGPoint(x: 99.64, y: 115.79), controlPoint1: CGPoint(x: 103.39, y: 111.8), controlPoint2: CGPoint(x: 101.27, y: 114.37))
path.addCurve(to: CGPoint(x: 91.5, y: 119.4), controlPoint1: CGPoint(x: 97.11, y: 118.13), controlPoint2: CGPoint(x: 94.4, y: 119.33))
path.addCurve(to: CGPoint(x: 83.99, y: 117.59), controlPoint1: CGPoint(x: 89.42, y: 119.4), controlPoint2: CGPoint(x: 86.91, y: 118.8))
path.addCurve(to: CGPoint(x: 75.9, y: 115.79), controlPoint1: CGPoint(x: 81.06, y: 116.39), controlPoint2: CGPoint(x: 78.36, y: 115.79))
path.addCurve(to: CGPoint(x: 67.58, y: 117.59), controlPoint1: CGPoint(x: 73.31, y: 115.79), controlPoint2: CGPoint(x: 70.54, y: 116.39))
@mkj-is
mkj-is / BezierPathLinearAnimation.swift
Created January 15, 2017 13:56
Simple linear animations in Swift
// Create new playground in Xcode and see the result for yourself
// or see the final result here: https://twitter.com/StudioTvor/status/820629171613433856
import UIKit
import PlaygroundSupport
// This is the bezier path that will be animated, feel free to change it or add another one and scroll down for animation.
let logotypePath = UIBezierPath()
logotypePath.move(to: CGPoint(x: 36.28, y: 53.92))
logotypePath.addCurve(to: CGPoint(x: 21.03, y: 48.14), controlPoint1: CGPoint(x: 32.17, y: 50.07), controlPoint2: CGPoint(x: 26.89, y: 48.14))
//
// Keyboardable.swift
//
// Created by Matěj Jirásek on 18/10/2016.
// Copyright © 2016 Matěj K. Jirásek. All rights reserved.
//
import Foundation
protocol Keyboardable {
@mkj-is
mkj-is / Nibable.swift
Last active October 13, 2020 10:20
Simple Nibable protocol for simple initialization of views from nib
//
// Nibable.swift
//
// Created by Matěj Kašpar Jirásek on 12/08/16.
// Copyright © 2016 Matěj Kašpar Jirásek. All rights reserved.
//
import UIKit
protocol Nibable {
@mkj-is
mkj-is / ActivityIndicatorStyleKit.swift
Last active March 30, 2016 15:18
PaintCode experiments
//
// ActivityIndicatorStyleKit.swift
//
//
// Created by Matěj Kašpar Jirásek on 30/03/16.
// Copyright (c) 2016 Matěj Kašpar Jirásek. All rights reserved.
//
// Generated by PaintCode (www.paintcodeapp.com)
//
@mkj-is
mkj-is / index.html
Created September 22, 2014 08:23
HTML template
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>---</title>
<meta name="description" content="---">
<meta name="author" content="Matěj Kašpar Jirásek">
<link rel="stylesheet" href="styles.css">
<!--[if lt IE 9]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
@mkj-is
mkj-is / yii-locales-min.php
Last active December 16, 2015 18:59
List of current yii locales in PHP array
<?php return array(
"aa", "af", "agq", "ak", "am", "ar", "as", "asa", "az", "bas", "be",
"bem", "bez", "bg", "bm", "bn", "bo", "br", "brx", "bs", "byn", "ca",
"cch", "cgg", "chr", "cs", "cy", "da", "dav", "de", "dje", "dua", "dv",
"dyo", "dz", "ebu", "ee", "el", "en", "eo", "es", "et", "eu", "ewo",
"fa", "ff", "fi", "fil", "fo", "fr", "fur", "ga", "gaa", "gd", "gez",
"gl", "gsw", "gu", "guz", "gv", "ha", "haw", "he", "hi", "hr", "hu",
"hy", "ia", "id", "ig", "ii", "in", "is", "it", "iu", "iw", "ja", "jmc",
"ka", "kab", "kaj", "kam", "kcg", "kde", "kea", "kfo", "khq", "ki", "kk",
"kl", "kln", "km", "kn", "ko", "kok", "kpe", "ksb", "ksf", "ksh", "ku", "kw",
@mkj-is
mkj-is / unzip.php
Last active March 30, 2016 14:21
For extracting archives during transferring lots of small files over FTP.
<?php
$zip = new ZipArchive;
$res = $zip->open('Archive.zip');
if ($res === TRUE) {
$zip->extractTo('./');
$zip->close();
echo 'ok';
} else {
echo 'failed';