This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile | |
import org.jlleitschuh.gradle.ktlint.reporter.ReporterType | |
plugins { | |
kotlin("jvm") | |
id("org.jlleitschuh.gradle.ktlint") | |
id("io.gitlab.arturbosch.detekt") | |
id("io.hkhc.jarbird") | |
// for build script debugging | |
id("org.barfuin.gradle.taskinfo") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun OkHttpClient.Builder.cleanupInterceptor() { | |
var foundLogger: Interceptor? = null | |
with(interceptors()) { | |
val newList = asSequence() | |
.filter { | |
if (it is HttpLoggingInterceptor) { | |
foundLogger = it | |
false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
LOG-APP: --> GET https://dog.ceo/api/breed/hound/images | |
LOG-APP: --> END GET | |
LOG-NET: --> GET https://dog.ceo/api/breed/hound/images http/1.1 | |
LOG-NET: Host: dog.ceo | |
LOG-NET: Connection: Keep-Alive | |
LOG-NET: Accept-Encoding: gzip | |
LOG-NET: User-Agent: okhttp/3.14.7 | |
LOG-NET: --> END GET | |
LOG-NET: <-- 200 OK https://dog.ceo/api/breed/hound/images (469ms) | |
LOG-NET: Date: Thu, 30 Apr 2020 08:41:20 GMT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val client = OkHttpClient.Builder().apply { | |
addInterceptor(HttpLoggingInterceptor( | |
HttpLoggingInterceptor.Logger { message -> | |
println("LOG-APP: $message") | |
}).apply { | |
level= HttpLoggingInterceptor.Level.BODY | |
}) | |
addNetworkInterceptor(HttpLoggingInterceptor( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const path = require('path'); | |
const TerserPlugin = require('terser-webpack-plugin'); | |
module.exports = { | |
entry: './src/index.js', | |
output: { | |
filename: 'bundle.js', | |
path: path.resolve(__dirname, 'dist') | |
}, | |
optimization: { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const path = require('path'); | |
var BomPlugin = require('webpack-utf8-bom'); // add this line | |
module.exports = { | |
entry: './src/index.js', | |
output: { | |
filename: 'bundle.js', | |
path: path.resolve(__dirname, 'dist') | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const path = require('path'); | |
module.exports = { | |
entry: './src/main.js', | |
output: { | |
filename: 'bundle.js', | |
path: path.resolve(__dirname, 'dist') | |
}, | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import _ from 'lodash'; | |
function component() { | |
const element = document.createElement('div'); | |
element.innerHTML = _.join(['Hello', 'webpack'], ' '); | |
return element; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html> | |
<head> | |
<title>Webpack Unicode Demo</title> | |
</head> | |
<body> | |
<h1>Webpack Unicode Demo</h1> | |
<script src="bundle.js"></script> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Assume you have three class to represent state of operations, | |
// and they have a common base class | |
sealed class BaseClass { | |
class ClassStart: BaseClass() | |
class ClassProgress(var percent: Int): BaseClass() | |
class ClassStop: BaseClass() | |
} | |
// Define the job here. It does not really execute it |
NewerOlder