Skip to content

Instantly share code, notes, and snippets.

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

Ezequiel Santos ezefranca

💻
👨🏻‍💻
View GitHub Profile
@discardableResult
@inlinable
private func with<T>(_ value: T, _ builder: (T) throws -> Void) rethrows -> T {
try builder(value)
return value
}
// Use
class MyClass {
var prop = "it's"
@NoraCodes
NoraCodes / esp8266_scan.ino
Last active October 18, 2022 10:35
Network scanner on ESP8266
/**
* ESP8266 Scanner - Scans for networks on the 2.4GHz band and prints them out to the console.
* Program it onto your ESP8266, pull up miniterm, the Serial Monitor, etc, and view a list of
* wireless networks on your computer.
* Requres Arduino JSON (http://arduinojson.org/), downloadable from Library Manager or GitHub.
* Or, set OUTPUT_JSON and consume the serial output with your favorite JSON parser.
*
* Created by Leonora Tindall in 2017 for the ESP8266.
* This software is licensed under the GNU General Public License, Version 3.0.
*/
@DejanEnspyra
DejanEnspyra / Obfuscator.swift
Created May 31, 2017 17:51
Obfuscation of hard-coded security-sensitive strings.
//
// Obfuscator.swift
//
// Created by Dejan Atanasov on 2017-05-31.
//
import Foundation
class Obfuscator: AnyObject {
@ivanseidel
ivanseidel / 3DFlip.swift
Last active May 7, 2017 03:05
TDC Florianopolis 2017 - Demos
import UIKit
import XCPlayground
import CoreGraphics
import PlaygroundSupport
/*
* Demo
*/
func applyPerspective(_ view: UIView, distance: CGFloat) {
view.layer.transform.m34 = 1.0 / distance
@Sorix
Sorix / ColorableNavigationController.swift
Created April 12, 2017 14:13
Colourable UINavigationController that supports different colors for navigation bars among different view controllers
//
// ColorableNavigationController.swift
//
// Created by Vasily Ulianov on 26.10.16.
//
import UIKit
/// Navigation bar colors for `ColorableNavigationController`, called on `push` & `pop` actions
public protocol NavigationBarColorable: class {
var navigationTintColor: UIColor? { get }
@trilliwon
trilliwon / uiimage-data.swift
Last active January 12, 2024 14:45
Swift UIImage to Data, Data to UIImage
// Swift4
let image = UIImage(named: "sample")
let data = image?.pngData()
let data = image?.jpegData(compressionQuality: 0.9)
let uiImage: UIImage = UIImage(data: imageData)
// deprecated
// var imageData: Data = UIImagePNGRepresentation(image)
@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
@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()
@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 }
}
@steipete
steipete / ios-xcode-device-support.sh
Last active October 14, 2024 16:35
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)