Skip to content

Instantly share code, notes, and snippets.

View ronanrodrigo's full-sized avatar
🚀
Go!

Ronan Rodrigo Nunes ronanrodrigo

🚀
Go!
View GitHub Profile
firAuth.createUser(withEmail: email, password: password, completion: nil)
import UIKit
import AVFoundation
import PlaygroundSupport
class Player: NSObject {
var player: AVQueuePlayer!
var playerItem: AVPlayerItem!
var playerContext = 0
@ronanrodrigo
ronanrodrigo / categories.json
Last active July 19, 2016 14:37
Category list
[
{
"id": 1,
"name": "Televisores"
},
{
"id": 2,
"name": "Celulares"
},
{
@ronanrodrigo
ronanrodrigo / products.json
Last active July 19, 2016 14:40
Product list
[
{
"name": "32\" Full HD Flat Smart TV H5103 Series 3",
"description": "Com o Modo futebol, é como se você estivesse realmente no jogo. Ele exibe, de forma precisa e viva, a grama verde do campo e todas as outras cores do estádio. Um poderoso efeito de som multi-surround também permite que você ouça toda a empolgação. Você pode até mesmo ampliar áreas selecionadas da tela para uma melhor visualização. Com apenas o toque de um botão, você pode aproveitar ao máximo o seu esporte favorito com todos os seus amigos.",
"photo": "https://simplest-meuspedidos-arquivos.s3.amazonaws.com/media/imagem_produto/133421/fda44b12-48f7-11e6-996c-0aad52ea90db.jpeg",
"price": 1466.10,
"category_id": 1
},
{
"name": "40\" Full HD Flat Smart TV H5103 Series 5",
class CustomersRouterApp: UINavigationController, CustomersRouter {
func backToList() {
// Fecha tela atual e chama outra.
popToViewController(listCustomersViewController, animated: true)
}
}
class CreateCustomerOutputPresenterApp: CreateCustomerOutputPresenter {
func show() {
// Apenas chama o router que vai apresentar a lista de clientes.
customersAppRouter.backToList()
}
}
public struct CreateCustomerInteractor {
var customerRepository: CustomerRepository
var createCustomerOutputPresenter: CreateCustomerOutputPresenter
public init(customerRepository: CustomerRepository, createCustomerOutputPresenter: CreateCustomerOutputPresenter) {
self.customerRepository = customerRepository
self.createCustomerOutputPresenter = createCustomerOutputPresenter
}
class CreateCustomerInputPresenterApp: CreateCustomerInputPresenter {
var newCustomerForm: NewCustomerForm
var createCustomerOutputPresenter: CreateCustomerOutputPresenterApp
init(newCustomerForm: NewCustomerForm) {
self.newCustomerForm = newCustomerForm
createCustomerOutputPresenter = CreateCustomerOutputPresenterApp()
}
protocol NewCustomerForm {
var enteredName: String? { get }
var enteredEmail: String? { get }
var enteredPhone: String? { get }
var enteredAddress: String? { get }
}
class NewCustomerViewController: UIViewController, NewCustomerForm {
// MARK: Outlets
@ronanrodrigo
ronanrodrigo / darkenColor.swift
Created February 18, 2016 22:00
Darken color
func darkenColor(color: NSString, amount: Float) -> (hexColor: String, color: NSColor) {
let originalRed = Float(Int(color.substringWithRange(NSRange(location: 0, length: 2)), radix: 16)!)
let originalGreen = Float(Int(color.substringWithRange(NSRange(location: 2, length: 2)), radix: 16)!)
let originalBlue = Float(Int(color.substringWithRange(NSRange(location: 4, length: 2)), radix: 16)!)
let valueRed = originalRed * amount
let darkenRed = String(format: "%02X", Int(valueRed))
let valueGreen = originalGreen * amount
let darkenGreen = String(format: "%02X", Int(valueGreen))