Skip to content

Instantly share code, notes, and snippets.

@crenwick
crenwick / mix.exs
Last active September 28, 2016 23:07
Alias for Elixir to run `mix dialyzer` and `mix test --stale`
defmodule KV.Mixfile do
use Mix.Project
def project do
[app: :kv,
version: "0.1.0",
elixir: "~> 1.3",
build_embedded: Mix.env == :prod,
start_permanent: Mix.env == :prod,
aliases: aliases,
@crenwick
crenwick / MVVMPlayground.swift
Created November 18, 2015 19:57
MVVM-ProtocolOriented
import UIKit
///////////////
// View Cell //
///////////////
protocol SwitchWithTextCellDataSource {
var title: String { get }
var switchOn: Bool { get }
}
@crenwick
crenwick / MVVMPlayground.swift
Created November 18, 2015 16:47
MVVM Pattern
import UIKit
struct Article {
var title: String
var body: String
var date: NSDate
var saved: Bool
var thumbnail: NSURL
}
@crenwick
crenwick / AnimationPlayground.swift
Created November 5, 2015 16:54
Draw a path with a semicircle, animation movement across it.
// Follow the horizon
import UIKit
import XCPlayground
import SpriteKit
let containerView = UIView(frame: CGRect(x: 0.0, y: 0.0, width: 375.0, height: 300.0))
let view = SKView(frame: CGRectMake(0, 0, 375, 120))
XCPlaygroundPage.currentPage.liveView = view
@crenwick
crenwick / AnimationPlayground.swift
Created November 4, 2015 15:08
Animation Playground Boilerplate
// Code from:
// https://possiblemobile.com/2015/03/prototyping-uiview-animations-swift-playground/
// &
// http://mathewsanders.com/animations-in-swift-part-two/
import UIKit
import XCPlayground
let startingColor = UIColor(red: (253.0/255.0), green: (159.0/255.0), blue: (47.0/255.0), alpha: 1.0)
let endingColor = UIColor(red: (255.0/255.0), green: (61.0/255.0), blue: (24.0/255.0), alpha: 1.0)
@crenwick
crenwick / dot w comment
Created November 18, 2014 23:52
dot with a comment
{ _id: '546bdb97875dcfc44b51617b',
time: 1416354711741,
latitude: 47.61,
longitude: -122.33,
color: 'blue',
title: 'Hey you, with the fancy shoes',
body: 'Nice shoes!!',
username_id: 'fred5459',
__v: 0,
comments: