Skip to content

Instantly share code, notes, and snippets.

@BoxResin
BoxResin / settings.gradle.kts
Created Feb 6, 2020
Gradle 서브 모듈 자동 탐지하여 include 하는 스크립트
View settings.gradle.kts
/** [name] 디렉터리 아래의 모듈을 모두 탐색하여 `AAA:BBB:CCC` 형식으로 반환한다. */
fun submodule(name: String): Array<String> {
// 모듈 디렉터리 탐색하기
val submoduleDirs: List<File> = fileTree(name)
.matching { include("**/*.gradle.kts") }
.map { gradleScript: File -> gradleScript.parentFile }
.distinct()
// gradle 프로젝트 이름 형식으로 고치기
return submoduleDirs
@BoxResin
BoxResin / AnyTest.kt
Created Apr 23, 2019
* 만 인식하는 문자열 매칭
View AnyTest.kt
class AnyTest {
@Test
fun test() {
"스파게티".matches("*스파게티").let { println(it) }
"스파게티".matches("스파게티").let { println(it) }
"소스파게티".matches("*스파게티").let { println(it) }
"소스파게티".matches("스파게티*").let { println(it) }
"스파게티테".matches("*스파게티").let { println(it) }
}
@BoxResin
BoxResin / config.yml
Created Oct 20, 2018
CircleCI setting file
View config.yml
version: 2
jobs:
build:
working_directory: ~/code
docker:
- image: circleci/android:api-28-alpha
environment:
JVM_OPTS: -Xmx3200m
TZ: "/usr/share/zoneinfo/Asia/Seoul"
steps:
@BoxResin
BoxResin / build.gradle
Created Oct 14, 2018
Kotlin Library Startup
View build.gradle
apply plugin: 'kotlin'
// 의존성
dependencies {
// 로컬 JAR
implementation fileTree(dir: 'libs', include: ['*.jar'])
// 코틀린
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}
@BoxResin
BoxResin / build.gradle
Last active Oct 26, 2018
Android Library Startup
View build.gradle
buildscript {
ext.kotlin_version = '1.2.71'
repositories {
google()
jcenter()
maven { url 'https://dl.bintray.com/minyushov/gradle' }
}
dependencies {
@BoxResin
BoxResin / SchoolSearchView.kt
Created Sep 27, 2018
급식 앱 - 학교 검색 SearchView
View SchoolSearchView.kt
package winapi251.app.schoolmeal.ui.main
import android.content.Context
import android.database.MatrixCursor
import android.util.Log
import androidx.appcompat.widget.SearchView
import androidx.cursoradapter.widget.SimpleCursorAdapter
import kotlinx.coroutines.experimental.Dispatchers
import kotlinx.coroutines.experimental.GlobalScope
import kotlinx.coroutines.experimental.android.Main
@BoxResin
BoxResin / AndroidManifest.xml
Last active Oct 13, 2019
Android Startup Non-Stable
View AndroidManifest.xml
<!-- 안드로이드 매니페스트 -->
<manifest
package = "boxresin.app.barcodescanner"
xmlns:android = "http://schemas.android.com/apk/res/android"
xmlns:tools = "http://schemas.android.com/tools">
<application
android:allowBackup = "false"
android:icon = "@mipmap/ic_launcher"
android:label = "@string/app_name"
@BoxResin
BoxResin / ExampleInstrumentedTest.kt
Last active Dec 21, 2018
AndroidJUnit4 + Robolectric
View ExampleInstrumentedTest.kt
package winapi251.app.schoolmeal
import android.content.Context
import androidx.test.core.app.ApplicationProvider
import androidx.test.ext.junit.runners.AndroidJUnit4
import org.junit.Assert.assertEquals
import org.junit.Test
import org.junit.runner.RunWith
@RunWith(AndroidJUnit4::class)
View AndroidStudio.gitignore
### Android ###
# Built application files
*.apk
*.ap_
# Files for the Dalvik VM
*.dex
# Java class files
*.class
View git-commands.sh
// Move the branch pointer to a different commit
git branch -f branch-name commit-name
// Cancel merging
git reset --hard ORIG_HEAD
git reset --merge ORIG_HEAD ;; If you wanna keep your changes
// Cancel editing a file
git checkout -- <file>
You can’t perform that action at this time.