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 | |
extension ImplicitlyUnwrappedOptional: BooleanType { | |
/// Gets the boolean value of an implicitly unwrapped optional type | |
/// For all .None or nil values return false. Otherwise return true | |
public var boolValue: Bool { | |
return self != nil | |
} |
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
// | |
// main.swift | |
// QuickSort | |
// | |
// Created by ChristianEnevoldsen on 17/08/15. | |
// Copyright © 2015 Reversebox. All rights reserved. | |
// | |
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
func initialize() { | |
self.layer.actions = [ | |
"onOrderOut": NSNull(), | |
"sublayers": NSNull(), | |
"contents": NSNull(), | |
"bounds": NSNull() | |
] | |
} | |
func changed() { |
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
def minMax(lower, upper, n): | |
return max(lower, min(upper, n)) | |
print minMax(0, 100, 100) == 100 | |
print minMax(0, 100, 101) == 100 | |
print minMax(0, 100, -1) == 0 | |
print minMax(0, 100, 101) / 100; |
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
;load "Random"; | |
(* Laver en liste fra 0 til og med n *) | |
fun listTo n = List.tabulate(n+1, fn n => n); | |
(* Skifter rækkefølgen af elementerne i en liste tilfældigt. | |
(Blander listen) *) | |
fun shuffle(xs) = | |
let | |
val rg = Random.newgen() |
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
// | |
// NSString+sizeWithFont.h | |
// UTNoteLabelView | |
// | |
// Created by Christian Enevoldsen on 05/08/13. | |
// Copyright (c) 2013 Utunity. All rights reserved. | |
// | |
#import <Foundation/Foundation.h> |