Skip to content

Instantly share code, notes, and snippets.

View micheltlutz's full-sized avatar
🎧

Michel Anderson Lütz Teixeira micheltlutz

🎧
View GitHub Profile
@micheltlutz
micheltlutz / pre-commit
Created November 8, 2022 00:40
Exemplo de arquivo pre-commit
#!/bin/bash
message=""
#----------------------------------------------------------------
# BUILD XCODE PROJECT & VALIDATE
#----------------------------------------------------------------
xcodebuild test -workspace MicroappArcExample.xcworkspace -scheme MicroappArcExample -sdk iphonesimulator -destination 'platform=iOS Simulator,OS=16.1,name=iPhone 14'
if test $? -eq 0
@micheltlutz
micheltlutz / Build_and_Archive.yml
Last active November 6, 2022 14:15
Workflow file that generates ipa artifact for project. following this tutorial:
# This workflow will build a Swift project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-swift
name: Build and Archive
on:
pull_request:
branches: [ "release" ]
@micheltlutz
micheltlutz / banco_codigo.json
Created October 17, 2020 20:51 — forked from antoniopresto/banco_codigo.json
JSON bancos do brasil com código
[
{
"value": "001",
"label": "Banco do Brasil S.A."
},
{
"value": "003",
"label": "Banco da Amazônia S.A."
},
{
import Foundation
private extension Collection where Element == Int {
var digitCPF: Int {
var number = count + 2
let digit = 11 - reduce(into: 0) {
number -= 1
$0 += $1 * number
} % 11
return digit > 9 ? 0 : digit
import Foundation
extension Collection where Element == Int {
var digitCNPJ: Int {
let upperBound = 9
let lowerBound = 2
let mod = 11
let secondMod = 10
let factors = Array((lowerBound...upperBound).reversed())
@micheltlutz
micheltlutz / pre-commit
Created July 16, 2020 18:54 — forked from joeblau/pre-commit
Pre commit git hook to run SwiftLint and SwiftFormat
#!/bin/bash
# Place this file in `.git/hooks/`
if which swiftlint >/dev/null; then
swiftlint autocorrect
else
echo "warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint"
fi
git diff --diff-filter=d --staged --name-only | grep -e '\(.*\).swift$' | while read line; do
@micheltlutz
micheltlutz / gist:dec1130f2d33686d468329126cdb685a
Created April 1, 2020 23:44 — forked from rxaviers/gist:7360908
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
@micheltlutz
micheltlutz / pre-commit
Created March 24, 2020 11:48 — forked from milankamilya/pre-commit
pre-commit git hook for iOS projects
#----------------------------------------------------------------
# PREVENT YOUR CODEBASE GETTING SPOILED BY DEVELOPERS
# - YOU NEED TO THIS pre-commit file (without any extension)
# at ".git/hooks/" folder.
# - THEN TRY TO PUT WRONG STYLED/LINT CODE
#----------------------------------------------------------------
branch="$(git rev-parse --abbrev-ref HEAD)"
#----------------------------------------------------------------
@micheltlutz
micheltlutz / MyreplacingOccurrences.swift
Created April 16, 2019 00:39
Replacing Multiple Occurrences
import Foundation
let texto = "Bem-[sexo:vindo,vinda] à aventura de viver a vida sendo você [sexo:mesmo,mesma], a partir de um espaço de liberdade, de escolhas e de possibilidades!"
protocol FilterTagProtocol {
var pattern: String { get }
}
struct FilterTagManager {
enum FiltersTexts: String, CaseIterable, FilterTagProtocol {
case gender = "\\[sexo:([^]]*)\\]"
case name = "\\[nome\\]"
@micheltlutz
micheltlutz / Border in TableView Sections
Last active January 29, 2024 19:08
Apply border around tableView Sections
/**
Extension for UITableViewController or UIViewController as you prefer
*/
extension UITableViewController {
func colorSection(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) {
let cornerRadius: CGFloat = 0.0
cell.backgroundColor = UIColor.clear
let layer: CAShapeLayer = CAShapeLayer()
let pathRef: CGMutablePath = CGMutablePath()
//dx leading an trailing margins