(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
| import UIKit | |
| import Lottie | |
| /// This class deals with the problems of updating animation frame with Lottie | |
| /// as described here https://github.com/airbnb/lottie-ios/issues/763 | |
| class AnimationView: UIView { | |
| private var previousSize: CGSize? | |
| private var frameUpdateDisplayLink: CADisplayLink? | |
| private var animationView: LOTAnimationView! = nil |
| // This is our delegate protocol for everything that happens on the server | |
| protocol ServerClient: class { | |
| func serverDidStart(_ server: Server) | |
| func serverDidEnd(_ server: Server) | |
| func server(_ server: Server, didReceive packet: Server.Packet) | |
| } | |
| // This is our server which will handle the socket connection with FreeCrypto socket service | |
| class Server { |
| // | |
| // GLView.swift | |
| // GLBarebones | |
| // | |
| // Created by Marko Hlebar on 18/03/2017. | |
| // Copyright © 2017 Marko Hlebar. All rights reserved. | |
| // | |
| import Cocoa | |
| import GLKit |
| import Foundation | |
| extension String { | |
| func snakecased() -> String { | |
| return self.replacingOccurrences(of: "(?<=[^A-Z])([A-Z])", with: "_$0", options: .regularExpression).lowercased() | |
| } | |
| } |
| #!/bin/sh | |
| KEY_CHAIN=ios-build.keychain | |
| security create-keychain -p travis $KEY_CHAIN | |
| # Make the keychain the default so identities are found | |
| security default-keychain -s $KEY_CHAIN | |
| # Unlock the keychain | |
| security unlock-keychain -p travis $KEY_CHAIN | |
| # Set keychain locking timeout to 3600 seconds | |
| security set-keychain-settings -t 3600 -u $KEY_CHAIN |
| extension String { | |
| func hashedColor() -> UIColor { | |
| var hash = self.hash | |
| var rgb = [CGFloat]() | |
| for _ in 0..<3 { | |
| rgb.append(CGFloat(hash % 100) / 100.0) | |
| hash = hash / 100 | |
| } | |
| //2, 1, 0 just gives nicer colors 😅 |
| func perform(query: String) { | |
| NotificationCenter.default.addObserver(self, | |
| selector: #selector(didUpdate(with:)), | |
| name: Notification.Name.NSMetadataQueryDidUpdate, | |
| object: nil) | |
| NotificationCenter.default.addObserver(self, | |
| selector: #selector(didFinish(with:)), | |
| name: Notification.Name.NSMetadataQueryDidFinishGathering, | |
| object: nil) |
| using UnityEngine; | |
| using System.Collections; | |
| public class BlendTreeRandomizer : MonoBehaviour { | |
| public Animator animator; //animator on which to act upon | |
| public string key; //what is the key in the blend tree | |
| public int numStates = 2; //how many states are there | |
| public float minTime = 1.0f; //minimum time spent in a state | |
| public float maxTime = 5.0f; //maximum time spent in a state |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
| // Taken from the commercial iOS PDF framework http://pspdfkit.com. | |
| // Copyright (c) 2013 Peter Steinberger. 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. |