Skip to content

Instantly share code, notes, and snippets.

View ezefranca's full-sized avatar
💻
👨🏻‍💻

Ezequiel Santos ezefranca

💻
👨🏻‍💻
View GitHub Profile
@mattrubin
mattrubin / WeakClassProtocol.swift
Last active August 12, 2017 21:13
Swift weak var of protocol type (No @objc required)
import UIKit
// A swift protocol can apply to a class, struct, or enum,
// but only a reference type can be stored in a `weak` var,
// so a weak var cannot be of a typical protocol type.
protocol MyProcotol {
}
@stonehippo
stonehippo / FTDI_Basic_Hookup_for_ESP-01.jpg
Last active January 6, 2022 14:09
Notes on using the ESP8266 with the Arduino IDE
FTDI_Basic_Hookup_for_ESP-01.jpg
@marchinram
marchinram / UIImage+PixelColor.swift
Last active January 19, 2022 08:53
iOS Swift UIImage subscript extension to get pixel color
import UIKit
extension UIImage {
subscript (x: Int, y: Int) -> UIColor? {
guard x >= 0 && x < Int(size.width) && y >= 0 && y < Int(size.height),
let cgImage = cgImage,
let provider = cgImage.dataProvider,
let providerData = provider.data,
let data = CFDataGetBytePtr(providerData) else {
return nil
@ezefranca
ezefranca / SPTransOlhoVivo.swift
Last active February 17, 2017 10:06
Acesso a API Olho Vivo da SPTrans em Swift (iOS)
+(NSString *)returnURL: (requestMethodGET)methodGET line:(id)line{
NSString *SPTrans = @"http://api.olhovivo.sptrans.com.br/v0";
switch (methodGET) {
case requestMethodGETLinhas: return [NSString stringWithFormat:@"%@/Linha/Buscar?termosBusca=%@", SPTrans, line]; break;
case requestMethodGETDetalhes: return [NSString stringWithFormat:@"%@/Linha/CarregarDetalhes?codigoLinha=%@", SPTrans, line] ;break;
case requestMethodGETParadas: return [NSString stringWithFormat:@"%@/Parada/Buscar?termosBusca=%@", SPTrans, line] ;break;
case requestMethodGETParadasPorLinha: return [NSString stringWithFormat:@"%@/Parada/BuscarParadasPorLinha?codigoLinha=%@", SPTrans, line] ;break;
case requestMethodGETParadasPorCorredor: return [NSString stringWithFormat:@"%@/Parada/BuscarParadasPorCorredor?codigoCorredor=%@", SPTrans, line] ;break;
case requestMethodGETCorredores: return [NSString stringWithFormat:@"%@/Corred
@vasarhelyia
vasarhelyia / rx_modelSelected.swift
Last active October 10, 2016 16:43
Table view selection binding in RxSwift
tableView
.rx_modelSelected(PasteboardItem)
.subscribeNext { [weak self] element in
self?.pasteViewModel.addItemsToPasteboard(element)
}.addDisposableTo(disposeBag)
@marmelroy
marmelroy / UIViewPropertyAnimator.swift
Last active November 9, 2022 02:28
A quick example of UIViewPropertyAnimator
// Create a UIViewPropertyAnimator object. Here's a simple one with a UIKit animation curve:
let colorChange = UIViewPropertyAnimator(duration: 0.3, curve: .easeIn, animations: { [weak self] in
self?.view.backgroundColor = UIColor(red: 255.0/255.0, green: 80.0/255.0, blue: 43.0/255.0, alpha: 1.0)
})
// There's also support for easy spring-based animations - all you need to set is a damping ratio (a value between 0 and 1). Alternatively, you can create your own curves by adopting the UITimingCurveProvider protocol.
let alphaChange = UIViewPropertyAnimator(duration: 0.3, dampingRatio: 0.6, animations: { [weak self] in
self?.circleView.alpha = 0.0
})
@steipete
steipete / ios-xcode-device-support.sh
Last active May 11, 2025 13:30
Using iOS 15 devices with Xcode 12.5 (instead of Xcode 13)
# The trick is to link the DeviceSupport folder from the beta to the stable version.
# sudo needed if you run the Mac App Store version. Always download the dmg instead... you'll thank me later :)
# Support iOS 15 devices (Xcode 13.0) with Xcode 12.5:
sudo ln -s /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport/15.0 /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport
# Then restart Xcode and reconnect your devices. You will need to do that for every beta of future iOS versions
# (A similar approach works for older versions too, just change the version number after DeviceSupport)
@chrisroff
chrisroff / Dismissible.swift
Created August 25, 2016 15:01
Dismissible & DismissalDelegate Protocols
import UIKit
protocol DismissalDelegate : class {
func finishedShowing(viewController: UIViewController)
}
protocol Dismissible : class {
weak var dismissalDelegate : DismissalDelegate? { get set }
}
@runys
runys / activity-indicator.swift
Last active April 18, 2019 14:45
Activity indicator in iOS 11 with Swift 4
// Create the Activity Indicator
let activityIndicator = UIActivityIndicatorView(activityIndicatorStyle: .gray)
// Add it to the view where you want it to appear
view.addSubview(activityIndicator)
// Set up its size (the super view bounds usually)
activityIndicator.frame = view.bounds
// Start the loading animation
activityIndicator.startAnimating()
@igorcferreira
igorcferreira / etica.txt
Last active January 27, 2017 10:08
Resposta à Bunee.io
A publicação de conteúdo em redes sociais não é uma construção de um CV público.
Assim como a contribuição com projetos open source não se caracteriza, por si só, como um portfólio de venda.
Não é porque postei receitas e fiz checkin em restaurantes que tenho pretensão em ser crítico da Michelin.
Vocês indexam e expõe devs como se os mesmos estivessem aptos a serem bombardeados com spam de empresas e propostas de freelas ou projetos irrelevantes para o profissional.
Inclusive, listando tecnologias que a pessoa não domina, gerando uma propaganda falsa.
Foram além e infringiram regras do GitHub para coleção de dados:
https://twitter.com/ezefranca/status/808344095919894529