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" ]
@0xTim
0xTim / deploy.swift
Last active December 19, 2022 13:13
A Swift script to deploy an app (in this case Vapor) to AWS Fargate from scratch. It first checks to see if there's a repository in ECR for the app, if not it creates one, builds the container and pushes it. It then checks for a registered task definition. In one doesn't exist in ECS, it updates the provided task definition with the latest ECR i…
#!/usr/bin/swift
import Foundation
// MARK: - Script variables
let awsProfileName: String? = "myProfile"
let serviceName = "someService"
// MARK: - Functions
@discardableResult
func shell(_ args: String..., returnStdOut: Bool = false, stdIn: Pipe? = nil) -> (Int32, Pipe) {
@cweinberger
cweinberger / EventLoopFuture+tryFlatMap.swift
Last active February 21, 2021 21:39
Vapor 4 Utilities
import NIO
/// Author: vzsg (Discord) - https://twitter.com/vzsg_dev
/// Source: https://discordapp.com/channels/431917998102675485/684159753189982218/684537099378098272
extension EventLoopFuture {
func tryFlatMap<NewValue>(
file: StaticString = #file,
line: UInt = #line,
_ callback: @escaping (Value) throws -> EventLoopFuture<NewValue>
@xtabbas
xtabbas / SnapCarousel.swift
Created May 10, 2020 18:13
A carousel that snap items in place build on top of SwiftUI
//
// SnapCarousel.swift
// prototype5
//
// Created by xtabbas on 5/7/20.
// Copyright © 2020 xtadevs. All rights reserved.
//
import SwiftUI
@rockbruno
rockbruno / buck_targets_to_test.swift
Last active October 14, 2019 23:50
Buck: Script to find out which rules should be tested based on what was changed
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 {
@unnamedd
unnamedd / MacEditorTextView.swift
Last active May 26, 2024 17:49
[SwiftUI] MacEditorTextView - A simple and small NSTextView wrapped by SwiftUI.
/**
* MacEditorTextView
* Copyright (c) Thiago Holanda 2020-2021
* https://twitter.com/tholanda
*
* MIT license
*/
import Combine
import SwiftUI
@joeblau
joeblau / pre-commit
Created June 1, 2019 16:57
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
@milankamilya
milankamilya / pre-commit
Last active September 8, 2023 08:19
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)"
#----------------------------------------------------------------
@antoniopresto
antoniopresto / banco_codigo.json
Last active October 21, 2024 16:09
JSON bancos do brasil com código
[
{
"value": "001",
"label": "Banco do Brasil S.A."
},
{
"value": "003",
"label": "Banco da Amazônia S.A."
},
{