BasicAuthGenerator.sh corre en linux/iOS
Descargar y luego habilitarles permisos de ejecución:
~ sudo chmod +x basicAuthGenerator.sh
~ ./basicAuthGenerator.sh nombre password
~ git checkout <commit hash> file | |
// source: https://stackoverflow.com/questions/215718/how-can-i-reset-or-revert-a-file-to-a-specific-revision |
<script> | |
function execPolyfill() { | |
(function(){ | |
// CustomElementsV1.min.js v1 polyfill from https://github.com/webcomponents/webcomponentsjs/tree/v1/src/CustomElements/v1. | |
/* | |
Copyright (c) 2016 The Polymer Project Authors. All rights reserved. | |
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt | |
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt |
//: Playground - noun: a place where people can play | |
import UIKit | |
protocol SectionModel { | |
var count: Int { get } | |
func cell(at: Int) -> UITableViewCell | |
func selected(at: Int) | |
} |
BasicAuthGenerator.sh corre en linux/iOS
Descargar y luego habilitarles permisos de ejecución:
~ sudo chmod +x basicAuthGenerator.sh
~ ./basicAuthGenerator.sh nombre password
let patternEmail = "[\\w0-9\\.]+@[\\w.]+" | |
let raw = "1 2 [email protected], [email protected]" | |
let replaceWith = "xxx" | |
let text = raw.replace(pattern: patternEmail, with: replaceWith) // example | |
struct ReplacerPlusResult { | |
let textReplaced: String | |
var rangesApplied: [Range<String.Index>] | |
} |
guard let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "locationChip", for: indexPath) as? MDCChipCollectionViewCell else { | |
return MDCChipCollectionViewCell() | |
} | |
let item = handler?.getRegisteredItems()[indexPath.row] | |
cell.chipView.titleLabel.text = item?.display | |
cell.alwaysAnimateResize = false | |
// Estableciendo la fuente personalizada | |
cell.chipView.titleFont = UIFont(name: "gothambook", size: 14) |
import UIKit | |
extension UISearchBar { | |
public var textField: UITextField? { | |
let subViews = subviews.flatMap { $0.subviews } | |
guard let textField = subViews.first(where: { $0 is UITextField }) as? UITextField else { | |
return nil | |
} | |
return textField | |
} |
class BooksTests: QuickSpec { | |
override func spec() { | |
describe("Book") { | |
let adapter = NetworkAdapter() | |
let mockFinder = MockBookFinder(adapter: adapter) | |
it("MockBookFinder.searchBy success") { | |
var wasSuccess = false | |
mockFinder.searchBy(author: "jhon doe", success: { data in | |
wasSuccess = true |
class MockBookFinder: BookFinderProtocol { | |
private var adapter: NetworkAdapter | |
private var totalSearch: Int | |
public init(adapter: NetworkAdapter){ | |
self.adapter = adapter | |
self.totalSearch = 0 | |
} | |
public func searchBy(author: String, success:((_ data:[BookModel?]) -> Void )? = nil, fail: FailCallback = nil) { | |
let dataFake:[BookModel] = [ |