Skip to content

Instantly share code, notes, and snippets.

View iurysza's full-sized avatar
📱
Mobile stuff

iury souza iurysza

📱
Mobile stuff
View GitHub Profile
@iurysza
iurysza / create-dependency-graph.gradle.kts
Created March 13, 2023 18:42
Creates a mermaid dependency graph for the project and add it to the README
task("createMermaidDependencyGraph") {
group = "Reporting"
description = "Creates a mermaid dependency graph for the project"
doLast {
val projects = mutableSetOf<Project>()
val dependencies = mutableListOf<Pair<Project, Project>>()
val queue = mutableListOf(rootProject)
while (queue.isNotEmpty()) {
val project = queue.removeAt(0)
queue.addAll(project.childProjects.values)
@iurysza
iurysza / CoroutineThrottler.kt
Created May 13, 2021 15:01
Generic throttleFirst behavior
import com.movile.faster.sdk.util.DispatcherProvider
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.CoroutineStart
import kotlinx.coroutines.Deferred
import kotlinx.coroutines.async
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
import java.util.concurrent.ConcurrentHashMap
class CoroutineThrottler(
@iurysza
iurysza / OpenInVim.applescript
Created April 12, 2021 12:23
Script to open a file in vim. Can be used with mac's Automator to create an application and set as the default app of some file extension.
on run {input, parameters}
set myPath to POSIX path of input
set cmd to "vim " & quote & myPath & quote
tell application "iTerm2"
tell current window
create tab with default profile
tell current session
write text cmd
end tell
end tell
@iurysza
iurysza / git-hooks.gradle
Created February 1, 2021 02:32
Install git hooks
static def isLinuxOrMacOs() {
def osName = System.getProperty('os.name').toLowerCase(Locale.ROOT)
return osName.contains('linux') || osName.contains('mac os') || osName.contains('macos')
}
task copyGitHooks(type: Copy) {
description 'Copies the git hooks from team-props/git-hooks to the .git folder.'
from("${rootDir}/team-props/git-hooks/") {
include '**/*.sh'
rename '(.*).sh', '$1'
@iurysza
iurysza / gradle.properties
Last active November 17, 2023 08:33
Publication strategy for kotlin libraries using proguard
libraryVersion=0.1.0
libraryArtifactId=kotlin-library
proguardVersion=7.0.1
@iurysza
iurysza / pre-commit-hook
Created December 20, 2020 19:00
Runs static analysis before every commit
#!/bin/bash
echo "Running git pre-commit hook"
./gradlew ktlintCi
./gradlew detektCi
RESULT=$?
# return 1 exit code if running checks fails
@iurysza
iurysza / detekt.gradle
Last active April 28, 2024 12:58
Gradle task that runs detekt only over changed files
configurations { detekt }
dependencies { detekt "io.gitlab.arturbosch.detekt:detekt-cli:$detektVersion" }
task detektCi(type: JavaExec, group: "verification") {
description = "Run Kotlin static analysis on changed files."
group = "CI"
main = "io.gitlab.arturbosch.detekt.cli.Main"
classpath = configurations.detekt
doFirst {
@iurysza
iurysza / ktlint.gradle
Last active April 22, 2024 11:14
Gradle task that runs ktlint only over changed files
configurations { ktlint }
dependencies { ktlint "com.pinterest:ktlint:$ktlintVersion" }
task ktlintCi(type: JavaExec, group: "verification") {
description = "Run Kotlin linter on changed files."
group = "CI"
main = "com.pinterest.ktlint.Main"
classpath = configurations.ktlint
doFirst {