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에 넣고 재사용하여 성능을 극대화 하는 방법을 제공한다.