Skip to content

Instantly share code, notes, and snippets.

@galcyurio
galcyurio / ViewModel.kt
Created January 7, 2021 00:39
auto disposable extension for ViewModel
package androidx.lifecycle
import io.reactivex.disposables.CompositeDisposable
import io.reactivex.disposables.Disposable
import java.io.Closeable
private const val JOB_KEY = "io.reactivex.disposables.Disposable.JOB_KEY"
val ViewModel.disposable: CompositeDisposable
get() {
import com.google.gson.Gson
import com.google.gson.JsonElement
import com.google.gson.TypeAdapter
import com.google.gson.TypeAdapterFactory
import com.google.gson.reflect.TypeToken
import com.google.gson.stream.JsonReader
import com.google.gson.stream.JsonWriter
/**
* custom ์ง๋ ฌํ™”, ์—ญ์ง๋ ฌํ™”์™€ default ์ง๋ ฌํ™”, ์—ญ์ง๋ ฌํ™”๋ฅผ ์„ž์–ด์„œ ์“ฐ๊ธฐ ์œ„ํ•œ [TypeAdapterFactory]์ด๋‹ค.
@galcyurio
galcyurio / Checkers.kt
Last active November 13, 2018 16:23
kotlin ๊ถŒํ•œ ์ฒดํฌ
interface EmailChecker {
fun checkEmail(email: String): Boolean = email.contains("@")
}
interface RoleChecker {
fun <T : Collection<String>> T.checkRole(role: String): Boolean = contains(role)
}
class FirstValidator {
fun validate(value: String): Boolean = TODO()
@galcyurio
galcyurio / bower.json
Created April 23, 2018 13:54
bower-installer ๋ฅผ ํ™œ์šฉํ•œ bower.json ์˜ˆ์ œ
{
"name": "tut-require-js",
"authors": [
"galcyurio <galcyurio@gmail.com>"
],
"description": "",
"main": "",
"license": "MIT",
"homepage": "",
"ignore": [
@galcyurio
galcyurio / launch.json
Last active April 9, 2018 18:58
chrome debugger ๋ฅผ ํ†ตํ•ด whale ๋ธŒ๋ผ์šฐ์ €๋ฅผ incognito(์‹œํฌ๋ฆฟ) ๋ชจ๋“œ + debugging ๋ชจ๋“œ๋กœ ์‹œ์ž‘ํ•˜๊ธฐ
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "chrome",
"request": "attach",
"name": "Attach to Chrome",
@galcyurio
galcyurio / guide.md
Last active July 15, 2017 16:40
python and pip zip version download guide

pip doesn't included in python 7zip version. So I searching and wandered around here and there. Finally, I installed pip in windows OS.

This guide for those who new to python and uses windows OS like me.

1. First, download python in this page python download link

You can download 2 types of python which are executable, web-based.__ The differences are here.

<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context=".activity.MainActivity2">
<android.support.design.widget.AppBarLayout
/*
* MIT License
*
* Copyright (c) 2016 Srijith Narayanan
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-type" content="text/html;charset=UTF-8">
<title>Show File Data</title>
<style type='text/css'>
body {
font-family: sans-serif;
}
</style>
--------------------------------------------------------------------------------------------------------
Apache Common DBCP
--------------------------------------------------------------------------------------------------------
Common DBCP๋ž€ :
Common DBCP๋Š” Apache Common์˜ ํ”„๋กœ์ ํŠธ ํ•˜์œ„์— ์žˆ๋Š” ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค ์ปค๋„ฅ์…˜ ํ’€์„ ์ œ๊ณตํ•˜๊ธฐ ์œ„ํ•œ ๊ธฐ๋Šฅ์„ ์ œ๊ณตํ•œ๋‹ค.
DB ํŠธ๋žœ์žญ์…˜์„ ์ฒ˜๋ฆฌํ•˜๊ธฐ ์œ„ํ•ด์„œ ๊ฐ€์žฅ ๋น„์šฉ์ด ๋งŽ์ด ๋“œ๋Š” ๊ฒƒ์€ ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค์™€ ์ปค๋„ฅ์…˜์„ ์‹ ๊ทœ๋กœ ์ƒ์„ฑํ•˜๋Š” ๊ณผ์ •์œผ๋กœ DBCP๋ฅผ ์ด์šฉํ•˜๋ฉด ์ƒ์„ฑ๋œ ์ปค๋„ฅ์…˜์„ pool์— ๋„ฃ๊ณ  ์žฌ์‚ฌ์šฉํ•˜์—ฌ ์„ฑ๋Šฅ์„ ๊ทน๋Œ€ํ™” ํ•˜๋Š” ๋ฐฉ๋ฒ•์„ ์ œ๊ณตํ•œ๋‹ค.