Skip to content

Instantly share code, notes, and snippets.

View micheltlutz's full-sized avatar
🎧

Michel Anderson Lütz Teixeira micheltlutz

🎧
View GitHub Profile
@mbuchetics
mbuchetics / codeableEnum.swift
Created June 30, 2017 09:30 — forked from reckenrode/codeableEnum.swift
Implement Codable on an enum
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
}
}
@krisanalfa
krisanalfa / macosx-install-php-oracle-oci8-pdo_oci.md
Last active January 11, 2024 22:00 — forked from gido/macosx-install-php-oracle-oci8.md
Install OCI8 and / or PDO_OCI on OSX via Brew

Installation

This procedure is tested on Mac OS X 10.10.5 with Developpers tools installed (xCode).

PHP 5.6 installed with Homebrew.

Preparation

Download the following files from Oracle website (yes, you need to create an account and accept terms):

@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)"
#----------------------------------------------------------------
@nguyentruongky
nguyentruongky / Gradient_border_button.md
Last active May 31, 2023 00:00
A library to create gradient border button

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.

@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) {
@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" ]
@skreutzberger
skreutzberger / emoji-console.swift
Created September 20, 2016 06:15
Colored level emojis in Xcode 8 & Swift 2.3
// set custom level strings to add color
let console = ConsoleDestination()
console.levelString.Verbose = "💜 VERBOSE"
console.levelString.Debug = "💚 DEBUG"
console.levelString.Info = "💙 INFO"
console.levelString.Warning = "💛 WARNING"
console.levelString.Error = "❤️ ERROR"
@eoghain
eoghain / UIFontExtensions.swift
Last active June 20, 2021 14:29
A UIFont extension in swift to load fonts from within a bundle
import UIKit
public extension UIFont {
class func loadAllFonts(bundleIdentifierString: String) {
registerFontWithFilenameString(filenameString: "icon-font.ttf", bundleIdentifierString: bundleIdentifierString)
// Add more font files here as required
}
static func registerFontWithFilenameString(filenameString: String, bundleIdentifierString: String) {
@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>