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 | |
enum BetterDecodingError: CustomStringConvertible { | |
case dataCorrupted(_ message: String) | |
case keyNotFound(_ message: String) | |
case typeMismatch(_ message: String) | |
case valueNotFound(_ message: String) | |
case any(_ error: Error) |
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
// | |
// DatePicker.swift | |
// CreditCard | |
// | |
// Created by Nuno Gonçalves on 13/11/16. | |
// Copyright © 2016 Nuno Gonçalves. All rights reserved. | |
// | |
import UIKit |
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 UIKit | |
class ViewController: UIViewController { | |
let tableView: UITableView = { | |
let tv = UITableView(frame: .zero, style: .plain) | |
tv.register(UITableViewCell.self, forCellReuseIdentifier: "Cell") | |
return tv | |
}() | |
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
$ = jQuery; | |
var indexToDelete = 0; | |
var numOfLinksToDelete = 200; | |
var waitUntilNextLinkInMs = 1000; | |
var waitForModalInMs = 50; | |
var confirmDelete = function() { | |
setTimeout(function() { | |
var $confirmationButtonInModal = $(".button-primary"); |
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 UIKit | |
import PlaygroundSupport | |
//http://stackoverflow.com/questions/72768/how-do-you-detect-credit-card-type-based-on-number | |
enum CreditCardType { | |
case visa | |
case visaElectron | |
case mastercard |
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
//Set a NSTimer to update call this function every n seconds to provide desired effect. | |
var numberOfDots = 3 | |
func applySearchingEffect() { | |
if let str = label.text { | |
let range = NSMakeRange(str.length - numberOfDots, numberOfDots) | |
var string = NSMutableAttributedString(string: str) | |
string.addAttribute(NSForegroundColorAttributeName, value: UIColor.clearColor(), range: range) | |
label.attributedText = 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
func screenshotService( | |
_ screenshotService: UIScreenshotService, | |
generatePDFRepresentationWithCompletion completionHandler: @escaping (Data?, Int, CGRect) -> Void | |
) { | |
... | |
} |
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
//: Playground - noun: a place where people can play | |
import UIKit | |
enum VehicleType : RawRepresentable { | |
struct Vehicle : Equatable { | |
let name: String | |
let wheels: Int |
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
//See the bottom of this file to check what you can do with this | |
let calendar = Calendar(identifier: .gregorian) | |
struct CalendarComponentAmount { | |
let component: Calendar.Component | |
let amount: Int | |
} | |
infix operator +: AdditionPrecedence |
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
// | |
// ZoomableImageView.swift | |
// ZoomableImage | |
// | |
// Created by Nuno Gonçalves on 01/04/17. | |
// Copyright © 2017 Nuno Gonçalves. All rights reserved. | |
// | |
import UIKit |
NewerOlder