This file contains 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
func isSmaller(smaller: CGSize, bigger: CGSize) -> Bool { | |
if(smaller.width >= bigger.width) { return false } | |
if(smaller.height >= bigger.height) { return false } | |
return true | |
} |
This file contains 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
// backgrounds: | |
.bgRed { | |
background-color: rgba(255,0,0,0.5)!important; | |
} | |
.bgYellow { | |
background-color: rgba(255,204,0,0.5)!important; | |
} | |
.bgGreen { |
This file contains 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
// | |
// LogHelper.swift | |
// | |
// Created by Samuel Beek on 24/06/15. | |
// Copyright (c) 2015 Samuel Beek. All rights reserved. | |
// http://twitter.com/samuelbeek | |
/// Logs objects | |
func log<T>(object: T) { |
This file contains 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
// this code does work, but since it's from a 'secret' project, I can't display | |
// the other code. Implement it in your own project, it'll work. | |
// | |
// LOCAL.swift | |
// Wildcard | |
// | |
// Created by Samuel Beek on 08/07/15. | |
// Copyright (c) 2015 Wildcard. All rights reserved. | |
// |
This file contains 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
// | |
// ColorHelper.swift | |
// Wildcard | |
// | |
// Created by Samuel Beek on 24/06/15. | |
// Copyright (c) 2015 Wildcard. All rights reserved. | |
// | |
import UIKit |
This file contains 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
// example if(Devices.iPhone4) { view.alpha = 0 } | |
struct Devices { | |
static let iPhone4 = UIScreen.mainScreen().bounds.size.height == 480.0 | |
static let iPhone5 = UIScreen.mainScreen().bounds.size.height == 568.0 | |
static let iPhone6 = UIScreen.mainScreen().bounds.size.height == 667.0 | |
static let iPhone6plus = UIScreen.mainScreen().bounds.size.height == 736.0 | |
} |
This file contains 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
// | |
// Analytics.swift | |
// Instant | |
// | |
// Created by Samuel Beek on 21/10/15. | |
// Copyright © 2015 Samue Beek. All rights reserved. | |
// | |
struct Analytics { | |
This file contains 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
// My way of doing constants in Swift. | |
// Usage example: if(Constants.debug) { println("debug message") } | |
struct Constants { | |
// App wide things: | |
static let debug = true | |
static let production = true | |
static let appVersion = "iOS-0.1.0b300" | |
static let apiBase = "http://api.com/1" |
This file contains 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
[ | |
{ | |
"code": "AD", | |
"emoji": "🇦🇩", | |
"unicode": "U+1F1E6 U+1F1E9", | |
"name": "Andorra", | |
"title": "flag for Andorra" | |
}, | |
{ | |
"code": "AE", |
This file contains 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
struct Uploader { | |
static let baseUrl = "YOUR API URL" | |
static func multipartBody(filePathKey: String, imageDataKey: NSData, boundary: String) -> NSData { | |
let body = NSMutableData(); | |
let filename = "user-profile.jpg" | |
let mimetype = "image/jpg" | |
body.appendString("--\(boundary)\r\n") |