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
let blacklists = ["*://jupyter.student.cs.uwaterloo.ca/*", "http://localhost:8888/notebooks/Documents/*"] |
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
//You can get the time components, but can only increment 1 second at a time. | |
struct Clock { | |
var seconds: Int = 0 { | |
didSet { | |
if seconds == 60 { | |
minutes += 1 | |
seconds = 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
convenience init(hex: String) { | |
var rgbValue:UInt32 = 0 | |
Scanner(string: hex).scanHexInt32(&rgbValue) | |
self.init(red: CGFloat((rgbValue & 0x00FF0000) >> 16) / 255.0, | |
green: CGFloat((rgbValue & 0x0000FF00) >> 8) / 255.0, | |
blue: CGFloat(rgbValue & 0x000000FF) / 255.0, | |
alpha: CGFloat((rgbValue & 0xFF000000) >> 24) / 255.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
// Photoshop Script to Create iPhone Icons from iTunesArtwork | |
// | |
// WARNING!!! In the rare case that there are name collisions, this script will | |
// overwrite (delete perminently) files in the same folder in which the selected | |
// iTunesArtwork file is located. Therefore, to be safe, before running the | |
// script, it's best to make sure the selected iTuensArtwork file is the only | |
// file in its containing folder. | |
// | |
// Copyright (c) 2010 Matt Di Pasquale | |
// Added tweaks Copyright (c) 2012 by Josh Jones http://www.appsbynight.com |
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
//Because swift thinks remainder is cooler than modulus | |
func modulus(number: Double, modulo: Double) -> Double { | |
var result = number % modulo | |
if result < 0 { | |
result += modulo | |
} | |
return result | |
} |
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 pointPairToDegrees(from: CGPoint, to: CGPoint) -> Double { | |
let origin = CGPointMake(to.x - from.x, to.y - from.y) | |
let bearingRadians = Double(atan2f(Float(origin.y), Float(origin.x))) | |
let bearingDegrees = bearingRadians * (180 / M_PI) | |
return modulus(bearingDegrees, modulo: 360) | |
} | |
func modulus(number: Double, modulo: Double) -> Double { | |
var result = number % modulo | |
if result < 0 { |