Skip to content

Instantly share code, notes, and snippets.

View spacedrabbit's full-sized avatar

Louis T. spacedrabbit

View GitHub Profile
@spacedrabbit
spacedrabbit / launch_sublime_from_terminal.markdown
Created June 27, 2017 16:04 — forked from artero/launch_sublime_from_terminal.markdown
Launch Sublime Text 2 from the Mac OS X Terminal

Launch Sublime Text 2 from the Mac OS X Terminal

Sublime Text 2 ships with a CLI called subl (why not "sublime", go figure). This utility is hidden in the following folder (assuming you installed Sublime in /Applications like normal folk. If this following line opens Sublime Text for you, then bingo, you're ready.

open /Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl

You can find more (official) details about subl here: http://www.sublimetext.com/docs/2/osx_command_line.html

Installation

@spacedrabbit
spacedrabbit / playgrounds_test.swift
Created June 16, 2017 21:07
Adding testing functionality to playgrounds
import XCTest
//
// Code described in detail here: http://initwithstyle.net/2015/11/tdd-in-swift-playgrounds/
//
public class ClosureTests: XCTestCase {
let observer = PlaygroundTestObserver()
let center = XCTestObservationCenter.shared()
@spacedrabbit
spacedrabbit / main.swift
Created May 18, 2017 20:30
Main swift from Day 1 of AC3.2-Server-Side-Swift-Vapor
import Vapor
import HTTP
let drop = Droplet()
drop.get() { (request: Request) in
return "Hey! Its the cat api!"
}
// localhost:8080/all-cats
@spacedrabbit
spacedrabbit / Cat.swift
Created May 18, 2017 20:27
Cat Model object from Day 1 of AC3.2-Server-Side-Swift-Vapor
import Foundation
import Vapor
import HTTP
class Cat: NodeRepresentable, JSONRepresentable, ResponseRepresentable {
let name: String!
let breed: String!
let favoriteSnack: String!
init(name: String, breed: String, snack: String) {
import UIKit
import SnapKit
// Stage 4 ensures that only tapping inside of the bounds of the view will cause the animations to happen
class TouchAnimatorViewController: UIViewController {
var animator: UIViewPropertyAnimator? = nil
let squareSize = CGSize(width: 100.0, height: 100.0)
var viewIsCurrentlyHeld: Bool = false
import UIKit
import SnapKit
// Stage three allows for click & drag functionality, along with scaling to simulate z-axis changes
class TouchAnimatorViewController: UIViewController {
var animator: UIViewPropertyAnimator? = nil
let squareSize = CGSize(width: 100.0, height: 100.0)
// MARK: - View LifeCycle
import UIKit
import SnapKit
// Stage 2 adds a scale transform allow with a delay factor animation to give the impression of "picking up" and "placing down" a view
class TouchAnimatorViewController: UIViewController {
var animator: UIViewPropertyAnimator? = nil
let squareSize = CGSize(width: 100.0, height: 100.0)
// MARK: - View LifeCycle
// Stage 1 simply moves the square's center point to the touch's location in self.view
// Tapping multiple times continues the same animation to the new point in the remaining animation duration
import UIKit
import SnapKit
class TouchAnimatorViewController: UIViewController {
let animator = UIViewPropertyAnimator(duration: 2.0, curve: .easeInOut, animations: nil)
let squareSize = CGSize(width: 100.0, height: 100.0)
import UIKit
import SnapKit
class ViewController: UIViewController {
static let animationDuration: TimeInterval = 1.0
let darkBlueAnimator = UIViewPropertyAnimator(duration: animationDuration, curve: .linear, animations: nil)
let tealAnimator = UIViewPropertyAnimator(duration: animationDuration, curve: .easeInOut, animations: nil)
let yellowAnimator = UIViewPropertyAnimator(duration: animationDuration, curve: .easeIn, animations: nil)
let orangeAnimator = UIViewPropertyAnimator(duration: animationDuration, curve: .easeOut, animations: nil)
import UIKit
import SnapKit
class ViewController: UIViewController {
static let animationDuration: TimeInterval = 1.0
let darkBlueAnimator = UIViewPropertyAnimator(duration: animationDuration, curve: .linear, animations: nil)
let tealAnimator = UIViewPropertyAnimator(duration: animationDuration, curve: .easeInOut, animations: nil)
let yellowAnimator = UIViewPropertyAnimator(duration: animationDuration, curve: .easeIn, animations: nil)
let orangeAnimator = UIViewPropertyAnimator(duration: animationDuration, curve: .easeOut, animations: nil)