This file contains hidden or 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
| # | |
| # Ejemplo para probar la instalación de Ruby | |
| # | |
| class User | |
| # Constructor | |
| def initialize(name) | |
| @name = name | |
| end |
This file contains hidden or 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
| # | |
| # Servicio que da nombre a un proyecto de Xcode | |
| # dependiendo de su tipo. | |
| # | |
| require 'sinatra' | |
| require_relative 'Oraculo' | |
| # | |
| # Antes de procesar cualquier ruta... |
This file contains hidden or 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
| # | |
| # El que da los nombre | |
| # | |
| class Oraculo | |
| # Nombre del proyecto | |
| attr_reader :name | |
| # Dominio del sitio web | |
| attr_reader :domain |
This file contains hidden or 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 CollectionType | |
| { | |
| /** | |
| Construye una cadena de texto con los elementos contenidos | |
| - parameter separator: Un caracter que se emplea para separar los elementos | |
| */ | |
| func descriptionWithSeparator(separator: String) -> String | |
| { | |
| return self.reduce(String()) |
This file contains hidden or 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
| var mutable_array: [Int] = [ 2, 8, 10, 3, 6, 5, 4, 7, 1, 9] | |
| mutable_array.sortInPlace() | |
| { | |
| let pares: (lhs: Bool, rhs: Bool) = (lhs: ($0 % 2 == 0), rhs: ($1 % 2 == 0)) | |
| switch pares | |
| { | |
| case (true, false): | |
| return false |
This file contains hidden or 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
| // Creacion de un semaforo | |
| let semaphore: dispatch_semaphore_t = dispatch_semaphore_create(0) | |
| // Liberamos el semaforo. | |
| //La ejecuion puede continuar | |
| dispatch_semaphore_signal(semaphore) | |
| // Este es el punto de bloqueo. | |
| // Aqui esperamos a que se llame | |
| // a la funcion `dispatch_semaphore_signal(sem)` | |
| dispatch_semaphore_wait(semaphore, DISPATCH_TIME_FOREVER) |
This file contains hidden or 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 testMovie() | |
| { | |
| // 214756 - Ted 2 | |
| // Creamos el objeto que nos ayudara a probar | |
| // la operacion asincrona | |
| let expectation: XCTestExpectation = self.expectationWithDescription("Test fanartForMovie()...") | |
| FanartClient.sharedInstance.fanartForMovie(214756) { (movie, error) -> (Void) in | |
| // Comprobamos si hay error... |
This file contains hidden or 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 testMovie() | |
| { | |
| // 214756 - Ted 2 | |
| // Este es el semaforo | |
| let semaphore: dispatch_semaphore_t = dispatch_semaphore_create(0) | |
| FanartClient.sharedInstance.fanartForMovie(214756) { (movie, error) -> (Void) in | |
| // Comprobamos si hay error... | |
| XCTAssertNil(error, "Se ha producido un error en el framework") |
This file contains hidden or 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
| /// | |
| /// Prueba de rendimiento para la operacion | |
| /// de recuperacion de datos para una serie de TV | |
| /// | |
| func testShow() | |
| { | |
| // Manhattan Love Story | |
| let showID: Int = 281624 | |
| // Closure de rendimiento |
This file contains hidden or 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
| /// | |
| /// La aportación de **Louis Van Gaal** | |
| /// al desarrollo del lenguaje Swift. | |
| /// | |
| /// La explicación en este vídeo de [Youtube](https://www.youtube.com/watch?v=Od5PQoRr7hU) | |
| /// | |
| extension SignedIntegerType | |
| { | |
| /** | |
| Convierte un número entero en negativo |
OlderNewer