Skip to content

Instantly share code, notes, and snippets.

View LiewJunTung's full-sized avatar

Liew Jun Tung LiewJunTung

View GitHub Profile
@LiewJunTung
LiewJunTung / kotlin_native_upload.kt
Last active May 24, 2019 07:05
Upload with Kotlin Native
sealed class UploadFileType
data class UploadFileForm(
val key: String,
val value: String,
val filename: String = "file.jpg",
val contentType: String = "image/jpeg"
) : UploadFileType()
data class UploadForm(
@LiewJunTung
LiewJunTung / build.gradle
Last active April 19, 2019 16:00
android build.gradle
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
@LiewJunTung
LiewJunTung / JavaDog.java
Last active April 16, 2019 04:14
Kotlin and Java reflection
package org.netvirta.javaApp;
public class JavaDog {
private String name = "John";
public String getName() {
return name;
}
public void setName(String name) {
package com.netvirta.common.login
data class User(val username: String, val password: Int)
import UIKit
import app
class ViewController: UIViewController, LoginView {
var presenter: LoginPresenter? = nil
@IBOutlet weak var textView: UILabel!
@IBOutlet weak var editText: UITextField!
@IBAction func clickSubmitButton(_ sender: Any) {
plugins {
id 'kotlin-multiplatform' version '1.3.21'
}
repositories {
google()
jcenter()
mavenCentral()
}
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android-extensions'
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.netvirta.android.login.LoginActivity">
<EditText
android:layout_width="wrap_content"
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.netvirta.android">
<application
android:allowBackup="true"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name="com.netvirta.android.login.LoginActivity">
<intent-filter>
package com.netvirta.android.login
import android.os.Bundle
import android.support.v7.app.AppCompatActivity
import com.netvirta.android.R
import com.netvirta.common.login.LoginPresenter
import com.netvirta.common.login.LoginPresenterImpl
import com.netvirta.common.login.LoginView
import kotlinx.android.synthetic.main.activity_login.*
task replaceTest {
doLast {
replaceText("$projectDir/tools/app_history_a", "history.txt", "OK Google", "OK Dara")
}
}
void replaceText(String folderPath, String match, String oldText, String newText) {
fileTree(folderPath).matching {
include match
}.each {