Skip to content

Instantly share code, notes, and snippets.

View rchatham's full-sized avatar
👨‍💻
code code code...

Reid Chatham rchatham

👨‍💻
code code code...
View GitHub Profile
@rchatham
rchatham / pyramid-of-DOOM.swift
Created December 6, 2016 01:56
Chaining UIView animations
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
@rchatham
rchatham / animations-with-SwiftyAnimate.swift
Created December 6, 2016 01:59
Chaining animations with SwiftyAnimate
// 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 / queue.swift
Created December 6, 2016 02:01
Queue using Node's in 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 / enqueue-animations.swift
Created December 6, 2016 02:28
Queueing animations
typealias Animation = (TimeInterval, ()->Void)
let animation: Animation = (5.0, {
// Code to animate
})
let animations = Queue<Animation>()
animations.enqueue(animation)
@rchatham
rchatham / dequeue-animations.swift
Last active December 6, 2016 02:34
Performing Queued animations
func perform() {
guard let animation = animations.dequeue else { return }
UIView.animate(withDuration: animation.0, animations: animation.1) { success in
perform()
}
}
@rchatham
rchatham / AppDelegate+CoordinatorType.swift
Last active February 27, 2017 00:48
CoordinatorType Example
import UIKit
extension AppDelegate: CoordinatorType {
weak internal var delegate: CoordinatorTypeDelegate? { return nil }
internal var childCoordinators: [CoordinatorType] {
get {
return AppDelegate.Static.childCoordinators
}
set {
//
// CoordinatorType.swift
//
// Created by Reid Chatham on 9/19/16.
//
#if os(macOS)
import Cocoa
public typealias MyViewController = NSViewController
public typealias MyTabController = NSTabViewController
@rchatham
rchatham / jwtRS256.sh
Created July 22, 2019 19:16 — forked from ygotthilf/jwtRS256.sh
How to generate JWT RS256 key
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
@rchatham
rchatham / JSONCafe-SwiftyJSON.template
Created September 1, 2020 17:23
A SwiftyJSON template file for models generated using JSONCafe
import Foundation
import SwiftyJSON
class {{className}}: Codable {
{{#properties}}
var {{nativeName}}: {{type}}
{{/properties}}
@rchatham
rchatham / tmux.conf
Last active February 28, 2024 07:27
tmux config
unbind C-b
set-option -g prefix C-Space
bind-key C-Space send-prefix
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
set-option -g mouse on