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
function ColorEvents() { | |
var today = new Date(); | |
var nextweek = new Date(); | |
nextweek.setDate(nextweek.getDate() + 14); | |
var calendars = CalendarApp.getAllOwnedCalendars(); | |
for (var i=0; i<calendars.length; i++) { | |
var calendar = calendars[i]; |
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
// Source: https://krakendev.io/force-touch-recognizers/ | |
// Without this import line, you'll get compiler errors when implementing your touch methods since they aren't part of the UIGestureRecognizer superclass | |
import UIKit.UIGestureRecognizerSubclass | |
//Since 3D Touch isn't available before iOS 9, we can use the availability APIs to ensure no one uses this class for earlier versions of the OS. | |
@available(iOS 9.0, *) | |
public class ForceTouchGestureRecognizer: UIGestureRecognizer { | |
//Since it also doesn't make sense to have our force variable as a settable property, I'm using a private instance variable to make our public force property read-only | |
private var _force: CGFloat = 0.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
// Inspiration: https://gist.github.com/NinoScript/47819cf6fe36d6845aee32d19b423e9b | |
//: Playground - noun: a place where people can play | |
import UIKit | |
enum SavableEnum { | |
case simpleCase | |
case associatedValue(String) | |
case anotherAssociated(Int) | |
} | |
extension SavableEnum { |
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
extension UIColor { | |
static func randomColor(alpha: CGFloat?) -> UIColor { | |
let red:CGFloat = CGFloat(drand48()) | |
let green:CGFloat = CGFloat(drand48()) | |
let blue:CGFloat = CGFloat(drand48()) | |
return UIColor(red: red, green: green, blue: blue, alpha: alpha ?? 1.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
// | |
// CartographyExtensions.swift | |
// portkey | |
// | |
// Created by Samuel Beek on 14/06/16. | |
// | |
// Note: still WIP. I only dealt with the equality operator (==), haven't worked on <= and ~ yet. | |
// But adding this won't be bad for you project, it saves me 70% compile time per block on avarage. | |
import Foundation |
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
import Foundation | |
public extension UIDevice { | |
public enum Model { | |
case iPodTouch5, iPodTouch6, iPhone4, iPhone4s, iPhone5, iPhone5c, iPhone5s, iPhone6, iPhone6Plus, iPhone6s, iPhone6sPlus, iPhoneSE, iPad2, iPad3, iPad4, iPadAir, iPadAir2, iPadMini, iPadMini2, iPadMini3, iPadMini4, iPadPro, AppleTV, Simulator, None | |
} | |
static var model: Model { | |
var systemInfo = utsname() |
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
// | |
// TypingLabel.swift | |
// | |
// Created by Samuel Beek on 09/12/15. | |
// Copyright © 2015 Samuel Beek. All rights reserved. | |
// | |
import UIKit | |
import SwiftyTimer |
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
self.resultSearchController = ({ | |
let controller = UISearchController(searchResultsController: nil) | |
controller.searchResultsUpdater = self | |
controller.dimsBackgroundDuringPresentation = false | |
controller.hidesNavigationBarDuringPresentation = false | |
controller.searchBar.barStyle = .Black | |
controller.searchBar.sizeToFit() | |
self.tableView.tableHeaderView = controller.searchBar | |
NewerOlder