Skip to content

Instantly share code, notes, and snippets.

🎧

Michel Anderson Lütz Teixeira micheltlutz

🎧
Block or report user

Report or block micheltlutz

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@rockbruno
rockbruno / buck_targets_to_test.swift
Last active Oct 14, 2019
Buck: Script to find out which rules should be tested based on what was changed
View buck_targets_to_test.swift
import Foundation
func run(command: String, wait: Bool = true) -> String? {
let task = Process()
task.launchPath = "/bin/bash"
task.arguments = ["-c", command]
let pipe = Pipe()
task.standardOutput = pipe
task.launch()
guard wait else {
@micheltlutz
micheltlutz / Rename.go
Last active Mar 28, 2018
Renomear arquivos removendo acento e espaço - GO
View Rename.go
package main
import (
"fmt"
"io/ioutil"
"log"
"os"
"unicode"
"golang.org/x/text/transform"
@ntamvl
ntamvl / install-multiple-jdk-on-macos-high-sierra.md
Last active Nov 21, 2019
Install Multiple Java Versions on macOS High Sierra
View install-multiple-jdk-on-macos-high-sierra.md

Install Multiple Java Versions on macOS High Sierra

Install Homebrew Cask

On Mac, Homebrew is the de-facto package manager, and Homebrew Cask is the app manager. I’m going to use Cask to install Java 7 and 8.

Install Homebrew Cask first if you haven’t:

brew update
brew tap caskroom/cask
@danielCarlosCE
danielCarlosCE / ChainResponsibility.playground.swift
Created Oct 13, 2017
Chain of Responsibility to handle errors on iOS application
View ChainResponsibility.playground.swift
import UIKit
class AppDelegate {
var window: UIWindow?
}
//Chain of Resposability: Handler
protocol ErrorHandler {
var errorHandlerSuccessor: ErrorHandler? {get}
func handleError(error: Error)
@PEZ
PEZ / UIControl+ListenBlock.swift
Created Sep 20, 2017
Swift3 UIControl extension for adding block event listeners. Adapted from: https://stackoverflow.com/a/44917661/44639
View UIControl+ListenBlock.swift
import Foundation
import UIKit
extension UIControl {
func listen(_ action: @escaping () -> (), for controlEvents: UIControlEvents) -> AnyObject {
let sleeve = ClosureSleeve(attachTo: self, closure: action, controlEvents: controlEvents)
addTarget(sleeve, action: #selector(ClosureSleeve.invoke), for: controlEvents)
return sleeve
}
@lattner
lattner / async_swift_proposal.md
Last active Nov 21, 2019 — forked from oleganza/async_swift_proposal.md
Concrete proposal for async semantics in Swift
View async_swift_proposal.md

Async/Await for Swift

Introduction

Modern Cocoa development involves a lot of asynchronous programming using closures and completion handlers, but these APIs are hard to use. This gets particularly problematic when many asynchronous operations are used, error handling is required, or control flow between asynchronous calls gets complicated. This proposal describes a language extension to make this a lot more natural and less error prone.

This paper introduces a first class Coroutine model to Swift. Functions can opt into to being async, allowing the programmer to compose complex logic involving asynchronous operations, leaving the compiler in charge of producing the necessary closures and state machines to implement that logic.

@mbuchetics
mbuchetics / codeableEnum.swift
Created Jun 30, 2017 — forked from reckenrode/codeableEnum.swift
Implement Codable on an enum
View codeableEnum.swift
struct User: Codable {
var name: String
var email: String
var id: String
var metadata: [String: MetadataType]
enum CodingKeys: String, CodingKey {
case name, email, id, metadata
}
}
@nguyentruongky
nguyentruongky / Gradient_border_button.md
Last active Nov 11, 2019
A library to create gradient border button
View Gradient_border_button.md

How to draw a gradient border button?

My Problem

Last week, my partner showed me his design for our application. Everything is great, easily implemented with some custom controls. But wait, something is not in my knowledge.

A button with gradient border. Never try it before. Up to now, I just created gradient background views 2 times in previous projects. Googled and found some good results.

@diefferson
diefferson / RemoveAcentos.php
Last active Aug 6, 2019
Função Para substituir caracteres com acentos por caracteres comuns
View RemoveAcentos.php
<?php
function removerAcentos( $string ) {
$mapaAcentosHex = array(
'a'=> '/[\xE0-\xE6]/',
'A'=> '/[\xE0-\xE6]/',
'e'=> '/[\xE8-\xEB]/',
'E'=> '/[\xE8-\xEB]/',
'i'=> '/[\xEC-\xEF]/',
View ios_locale_identifiers_feb2017.csv
localeIdentifier Description
eu Basque
hr_BA Croatian (Bosnia & Herzegovina)
en_CM English (Cameroon)
en_BI English (Burundi)
rw_RW Kinyarwanda (Rwanda)
ast Asturian
en_SZ English (Swaziland)
he_IL Hebrew (Israel)
ar Arabic
You can’t perform that action at this time.