This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.awt.BasicStroke; | |
import java.awt.Color; | |
import java.awt.Dimension; | |
import java.awt.EventQueue; | |
import java.awt.Graphics; | |
import java.awt.Graphics2D; | |
import java.awt.RenderingHints; | |
import java.awt.event.ActionEvent; | |
import java.awt.event.ActionListener; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
import UIKit | |
// MARK: Base animation | |
public class Animation { | |
internal var displayLink: CADisplayLink? | |
public var isRunning: Bool { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
internal extension FloatingPoint { | |
var degreesToRadians: Self { return self * .pi / 180 } | |
var radiansToDegrees: Self { return self * 180 / .pi } | |
} | |
extension UIImage { | |
func circularProgress(_ progress: Double, | |
grayScaleAlpha: Double = 1.0, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
import UIKit | |
public class ImageViewProgess: UIImageView { | |
fileprivate var actualImage: UIImage? | |
fileprivate var grayScaleImage: UIImage? | |
@IBInspectable public override var image: UIImage? { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.concurrent.locks.Condition; | |
import java.util.concurrent.locks.ReentrantLock; | |
import java.util.logging.Level; | |
import java.util.logging.Logger; | |
public class Test { | |
public static void main(String[] args) throws InterruptedException { | |
ReentrantLock lock = new ReentrantLock(); | |
Condition con = lock.newCondition(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.time.Duration; | |
import java.time.LocalDateTime; | |
public abstract class AbstractAnimatable<T> implements Animatable<T> { | |
private Range<T> range; | |
private LocalDateTime startTime; | |
private Duration duration = Duration.ofSeconds(5); | |
private T value; | |
private AnimatableListener<T> animatableListener; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
extension String { | |
var trimmed: String { | |
return self.trimmingCharacters(in: .whitespacesAndNewlines) | |
} | |
var isEmptyWhenTrimmed: Bool { | |
return trimmed.isEmpty |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
import UIKit | |
// I'm not a fan of this, but this will allow us to maintain state beyond the capabailities of the the extension API | |
fileprivate var cache = NSMapTable<UIViewController, UITapGestureRecognizer>(keyOptions: .weakMemory, valueOptions: .weakMemory) | |
extension UIViewController { | |
fileprivate var tapRecognizer: UITapGestureRecognizer? { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
import UIKit | |
extension UIViewController { | |
@objc func hideKeyboard() { | |
UIApplication.shared.sendAction(#selector(UIApplication.resignFirstResponder), to: nil, from: nil, for: nil) | |
} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
import UIKit | |
// I'm not a fan of this, but this will allow us to maintain state beyond the capabailities of the the extension API | |
fileprivate var cache = NSHashTable<UIViewController>(options: .weakMemory) | |
extension UIViewController { | |
fileprivate var isInstalled: Bool { |