Skip to content

Instantly share code, notes, and snippets.

View dotkebi's full-sized avatar

Myoung-jin, Ko dotkebi

View GitHub Profile
@dotkebi
dotkebi / java_unchecked_warning.java
Last active March 20, 2016 12:46
java unchecked warning
List<MyObject> arrayList = new ArrayList<>();
if (resultMap.get("key") instanceof List) {
List list = (List) resultMap.get("key");
for (Object item : list) {
if (item instanceof MyObject) {
arrayList.add((MyObject) item);
}
}
}
@dotkebi
dotkebi / logcat_by_regex.txt
Last active March 12, 2016 04:20
android filtering logcat by regex
^(?!(dalvikvm|ContextImpl|Watchdog|registerCallback))
@dotkebi
dotkebi / HttpConnectionHelper.java
Created March 29, 2016 13:30
Java HttpUrlConnection Helper
import org.json.JSONException;
import org.json.JSONObject;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
@dotkebi
dotkebi / sampleclass.java
Last active April 12, 2016 01:34
sample class
@DatabaseTable()
public class SomeEntity() {
@ForeignCollectionField()
private Collection<DetailEntity> detailEntities = new HashSet<>();
}
@DatabaseTable()
public class DetailEntity() {
@DatabaseField(foreign = true, foreignAutoRefresh = true)
private SomeEntity someEntity = new SomeEntity();
$ brew update
$ brew install rbenv ruby-build
@dotkebi
dotkebi / gradle.properties
Last active May 11, 2016 06:40
gradle.properties
org.gradle.daemon=true
org.gradle.parallel=true
@dotkebi
dotkebi / SimpleTextWatcher.java
Created May 20, 2016 05:04
Android Simple TextWatcher
/**
* @author by [email protected] on 2016-05-20.
*/
public class SimpleTextWatcher implements TextWatcher {
public interface AfterTextChanged {
void afterTextChanged(Editable s);
}
private AfterTextChanged afterTextChanged;
@dotkebi
dotkebi / PageInfo.java
Created August 3, 2016 10:28
Velocity paging snippet
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @author by [email protected] on 2016-08-01.
*/
@Data
@NoArgsConstructor
public class PageInfo {
public static final int QUANTITY_OF_CONTENTS_PER_PAGE = 20;
@dotkebi
dotkebi / selectAjax.js
Created August 3, 2016 10:32
javascript select options by ajax
<script>
function onCodeChanged() {
var select = document.getElementById('category');
var value = select.options[select.selectedIndex].value;
var text = select.options[select.selectedIndex].text + '선택';
$.ajax({
type: "POST"
, url: "url"
, data: "category=" + value
, success: function (response) {
@dotkebi
dotkebi / CustomAuthenticationProvider.java
Last active November 15, 2021 21:53
SpringSecurity Authentication
@Component
public class CustomAuthenticationProvider implements AuthenticationProvider {
@Autowired
private AuthServiceImpl authService;
@Override
public Authentication authenticate(Authentication authentication) throws AuthenticationException {
String username = authentication.getName();
String password = (String) authentication.getCredentials();