Skip to content

Instantly share code, notes, and snippets.

Reid Chatham rchatham

Block or report user

Report or block rchatham

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@rchatham
rchatham / jwtRS256.sh
Created Jul 22, 2019 — forked from ygotthilf/jwtRS256.sh
How to generate JWT RS256 key
View jwtRS256.sh
ssh-keygen -t rsa -b 4096 -m PEM -f jwtRS256.key
# Don't add passphrase
openssl rsa -in jwtRS256.key -pubout -outform PEM -out jwtRS256.key.pub
cat jwtRS256.key
cat jwtRS256.key.pub
View CoordinatorType-CrossPlatform.swift
//
// CoordinatorType.swift
//
// Created by Reid Chatham on 9/19/16.
//
#if os(macOS)
import Cocoa
public typealias MyViewController = NSViewController
public typealias MyTabController = NSTabViewController
View AppDelegate+CoordinatorType.swift
import UIKit
extension AppDelegate: CoordinatorType {
weak internal var delegate: CoordinatorTypeDelegate? { return nil }
internal var childCoordinators: [CoordinatorType] {
get {
return AppDelegate.Static.childCoordinators
}
set {
@rchatham
rchatham / dequeue-animations.swift
Last active Dec 6, 2016
Performing Queued animations
View dequeue-animations.swift
func perform() {
guard let animation = animations.dequeue else { return }
UIView.animate(withDuration: animation.0, animations: animation.1) { success in
perform()
}
}
View enqueue-animations.swift
typealias Animation = (TimeInterval, ()->Void)
let animation: Animation = (5.0, {
// Code to animate
})
let animations = Queue<Animation>()
animations.enqueue(animation)
@rchatham
rchatham / queue.swift
Created Dec 6, 2016
Queue using Node's in Swift
View queue.swift
internal class Node<T> {
var data: T
var next: Node<T>?
init(data: T) {
self.data = data
}
}
internal struct Queue<T> {
var first, last: Node<T>?
@rchatham
rchatham / animations-with-SwiftyAnimate.swift
Created Dec 6, 2016
Chaining animations with SwiftyAnimate
View animations-with-SwiftyAnimate.swift
// Escape the Pyramid of DOOM!
Animate(duration: time) { [unowned self] in
// animation
self.animationFunction()
}.do { [unowned self] in
// non-animation function
self.nonAnimationFunction()
}.then(duration: time) { [unowned self] in
// animation
self.animationFunction()
@rchatham
rchatham / pyramid-of-DOOM.swift
Created Dec 6, 2016
Chaining UIView animations
View pyramid-of-DOOM.swift
UIView.animate(withDuration: time, animations: { [unowned self] in
// animation
self.animationFunction()
}) { [unowned self] success in
// non-animation function
self.nonAnimationFunction()
UIView.animate(withDuration: time, animations: {
// animation
self.animationFunction()
}) { success in
You can’t perform that action at this time.