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
// | |
// URL+QR.swift | |
// URL extension to generate QR code from an URL | |
// | |
// Created by Adolfo Vera Blasco on 29/03/2019. | |
// Copyright © 2019 Adolfo Vera Blasco. All rights reserved. | |
// | |
import UIKit | |
import CoreImage |
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
<!-- web.config ASP.NET // IIS --> | |
<configuration> | |
<system.webServer> | |
<directoryBrowse enabled="true" /> | |
<staticContent> | |
<clear /> | |
<mimeMap fileExtension="*" mimeType="application/octet-stream" /> | |
</staticContent> | |
</system.webServer> | |
</configuration> |
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 | |
// | |
// MODEL | |
// | |
public struct Show: Codable { | |
public var name: String | |
public var network: String | |
} |
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 // Always import Foundation, no matter what you're developing | |
public struct Interview // Use structs, Apple loves structs, then me too. Why? Cause Apple love structs. | |
{ | |
// ¡Oh fortuna! ¿por qué eres tan esquiva conmigo? (Yes, spanish too) | |
private var result: Bool | |
/// Human readable result. | |
public var resultMessage: String | |
{ |
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 struct Queue<Element> | |
{ | |
private var storage: [Element] | |
public init() | |
{ | |
self.storage = [Element]() |
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 struct Stack<Element> | |
{ | |
private var storage: [Element] | |
public init() | |
{ | |
self.storage = [Element]() | |
} |
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 phrase: String = "If you know what you know if I..." | |
let words = phrase.split(separator: " ") | |
/// Check if a given word is includen in a string | |
/// before the own word. | |
func containsWord(_ word: String, offsetLimit limit: Int) -> Bool | |
{ | |
return words.enumerated() | |
.filter({ $0.offset < limit }) | |
.map({ String($0.element) }) |
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 Array | |
{ | |
/** | |
Insert an element n-times in the array | |
with a gap between each element's insertion. | |
``` | |
var numbers: [String] = [ "1", "2", "3", "4", "5", "6", "7", "8", "9", "10" ] | |
numbers.repeat("X", gap: 3, fromTheBeginning: false) | |
``` |
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
// | |
// New `joined` and `split` functions in Swift 4.1 | |
// | |
// More info at Swift [Array Documentacion](https://developer.apple.com/documentation/swift/array) | |
// | |
import Foundation | |
// The sample data... | |
let data: [String] = [ "Col1", "Col2", "Col3", "Col4", "Col5"] |
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
// An array with Int, Double and String types inside | |
let items: [Any] = [ 32, 32.0, "32" ] | |
for item in items | |
{ | |
switch type(of: item) | |
{ | |
case is Int.Type: | |
print("Type Int: \(item)") |