Skip to content

Instantly share code, notes, and snippets.

View har5hit's full-sized avatar
📱
Building Awesome Mobile Apps

Harshith Shetty har5hit

📱
Building Awesome Mobile Apps
View GitHub Profile
@har5hit
har5hit / SuspendFunctionsFromSwift.md
Created August 3, 2022 20:25
Calling kotlin suspend functions from Swift

Works

Suspend function can be called from swift on Main thread. Examples:

// Sample.kt
suspend fun add(a: Int, b: Int): Int {
    return a + b;
}

// Sample.swift
@har5hit
har5hit / FragmentTemplate.ejs.t
Last active March 30, 2021 10:34
Sample hygen fragment template
---
to: <%= module %>/src/main/java/com/justadeveloper96/pokedex/<%= module %>/presentation/<%=h.changeCase.snake(name) %>/fragment/<%=name %>Fragment.kt
---
<%
folder = h.changeCase.snake(name)
name_snake = h.changeCase.snake(name)
%>
package com.justadeveloper96.pokedex.<%= module %>.presentation.<%=folder %>.fragment
@har5hit
har5hit / AppDevJenkinsDockerfile
Last active April 30, 2020 16:10
DockerFile with Jenkins, Android, Flutter, Gradle, Docker, Docker Compose
------------Dockerfile-----------------
# Setting the base image of which docker image is being created
FROM jenkins/jenkins:lts
# Switching to root user to install dependencies and flutter
USER root
#Flutter
private val TAG = "$className$";
Edit variables->
className | groovyScript("_1.take(Math.min(23, _1.length()));", kotlinClassName())
@har5hit
har5hit / Android AppLinks
Last active April 15, 2019 12:49
Gradle script to generate App Links for all app variants in an Android project.
@har5hit
har5hit / SimpleListingScreen
Last active April 24, 2019 17:53
File template for simple listing screen with activity and recycler view. Add them in Settings -> File and Code Templates -> File
-----Activity-----
#if (${PACKAGE_NAME} != "")package ${PACKAGE_NAME};#end
import android.arch.lifecycle.Observer
import android.databinding.DataBindingUtil
import android.os.Bundle
import android.support.v7.widget.LinearLayoutManager
class ${NAME}Activity : AppCompatActivity() {
@har5hit
har5hit / Binding adapters 101
Created October 14, 2018 10:25
Binding adapter, pass string as attribute
bind:selectedConstantType="@{`SHIRTS`}"
@InverseBindingAdapter(attribute = "selectedConstantValue", event = "selectedConstantValueAttrChanged")
@BindingAdapter(value = {"selectedConstantValue","selectedConstantType", "selectedConstantValueAttrChanged"}, requireAll = false)
buildTypes {
debug{
testCoverageEnabled true
}
}
./gradlew testDebugUnitTest
./gradlew createDebugCoverageReport
app.gradle/
kaptTest deps.dagger.compiler
testImplementation deps.kotlin.test
testImplementation deps.arch_core.testing
tasks/
compileDebugUnitTestSources
---- JAVA ----
@Binds
@IntoMap
@ViewModelKey($ViewModelClassName$.class)
abstract ViewModel bind$ViewModelClassName$($ViewModelClassName$ $ViewModelVariable$);
---- KOTLIN ----
@Binds