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
using System.Collections; | |
using UnityEngine; | |
public class CoroutineContinueFailure: MonoBehaviour { | |
void Start() { | |
LogTimeCoroutine = StartCoroutine(LogTime()); | |
} | |
Coroutine LogTimeCoroutine; | |
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 UIControl { | |
override public func didMoveToSuperview() | |
{ | |
super.didMoveToSuperview() | |
alterControlEventsAssignment(addTarget) | |
} | |
override public func removeFromSuperview() | |
{ | |
super.removeFromSuperview() |
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
// It would help if Xcode visually differentiated between verbs and deverbal nouns. | |
// It can get a little confusing using a human brain to parse which of those options each meow is. | |
class Cat { | |
init(meow: String = "Meow.") { | |
// How this might look in Swift in the future. | |
// self.meow.init(meow: meow) | |
// How I have been emulating that | |
// Pronounce 🐣 as "hatch" to understand its purpose. |
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 CoreData | |
/// Designed to add functionality to classes deriving from *NSManagedObject* | |
protocol Managed {} | |
// This keeps us from having to explicitly implement Managed | |
// on all NSManagedObject subclasses. | |
extension NSManagedObject: Managed {} | |
// Managed is extended instead of NSManagedObject, |
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
for 🔢 in 1...100{print([3:"Fi",5:"Bu"].reduce(nil){🔢%$1.0==0 ?$1.1+"zz"+($0 ?? ""):$0} ?? 🔢)} //93 | |
for 🔢 in 1...100{print(🔢%15==0 ?"FizzBuzz":🔢%3==0 ?"Fizz":🔢%5==0 ?"Buzz":"\(🔢)")} //81 | |
(1...100).forEach{print($0%15==0 ?"FizzBuzz":$0%3==0 ?"Fizz":$0%5==0 ?"Buzz":"\($0)")} //86 |
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
enum StringPaddingStyle {case Left, Right} | |
func padStringToLength( | |
sourceString: String, | |
destinationCount: Int, | |
paddingStyle: StringPaddingStyle = .Left, | |
paddingCharacter: Character = " " | |
) -> String { | |
let padCount = destinationCount - sourceString.characters.count, | |
padString = String(count: padCount, repeatedValue: paddingCharacter) |
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
infix operator • {precedence 255} | |
/// Used when you'd normally use the dot operator to get a property, | |
/// but you have to store that operation as a closure for whatever reason. | |
/// | |
///- Parameter instance: instance on which you'd normally use a dot | |
///- Parameter property: returns a Property when supplied with an instance | |
/// | |
///- Returns: the property | |
/// |
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
public struct CoreError: ErrorType { | |
public init( | |
_ reason: String, | |
_ context: String = __FILE__ | |
) { | |
self.reason = reason | |
self.context = context | |
} | |
let |
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
infix operator • {precedence 255} | |
/// Used when you'd normally use the dot operator to get a property, | |
/// but you have to store that operation as a closure for whatever reason. | |
/// | |
///- Parameter instance: instance on which you'd normally use a dot | |
///- Parameter property: returns a Property when supplied with an instance | |
/// | |
///- Returns: the property | |
/// |