Skip to content

Instantly share code, notes, and snippets.

View karian7's full-sized avatar
🎯
Focusing

koasu karian7

🎯
Focusing
View GitHub Profile
-- insert
insert into account_history (email, create_time, description) values (:email, CURRENT_TIMESTAMP, :description)
-- select
select email, create_time, description from account_history where email = :email
-- delete
delete from account_history where email = :email
package com.daumcorp.be;
import org.junit.Test;
import org.postgresql.ds.PGSimpleDataSource;
import java.util.List;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
/**
* This method ensures that the output String has only
* valid XML unicode characters as specified by the
* XML 1.0 standard. For reference, please see
* <a href=”http://www.w3.org/TR/2000/REC-xml-20001006#NT-Char”>the
* standard</a>. This method will return an empty
* String if the input is null or empty.
*
* @param in The String whose non-valid characters we want to remove.
* @return The in String, stripped of non-valid characters.
@karian7
karian7 / pom.xml
Last active August 29, 2015 13:56
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>9.3-1100-jdbc41</version>
</dependency>
package com.daumcorp.be;
/**
* Created by karian7 on 1/20/14.
*/
public interface AccountRepository {
Account findByEmail(String email);
void save(Account account);
int deleteByEmail(String email);
}
package com.daumcorp.be;
import org.junit.Before;
import org.junit.Test;
import javax.sql.DataSource;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.HashMap;
@karian7
karian7 / AppTests.java
Created February 11, 2014 01:13
springmvc_3_2_unitttest
package com.springapp.mvc;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
import static org.springframework.test.web.servlet.setup.MockMvcBuilders.*;
import java.util.List;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
<div id="emptySwf"></div> ## μ΅œμ‹  ν¬λ‘¬λΈŒλΌμš°μ €μ—μ„œ iframe내에 ν”Œλž˜μ‹œλ‘œλ“œμ‹œ ν™”λ©΄κΉœλΉ‘μž„ λ°œμƒλ²„κ·Έλ₯Ό νšŒν”Όν•˜κΈ°μœ„ν•΄ κ°€μ§œ ν”Œλž˜μ‹œλ₯Ό μž„λ² λ“œμ‹œν‚¨λ‹€.
<script type="text/javascript">
//<![CDATA[
try {
if(daum.Browser.chrome) {
var swfParam = {
swfurl: 'http://cafeimg.daum-img.net/swf/',
params: {
wmode: 'transparent',
base: 'http://cafeimg.daum-img.net/swf/'
@karian7
karian7 / MessageDigestHelper.java
Last active January 2, 2016 16:29
MessageDigestHelper
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
public class MessageDigestHelper {
/**
* input 을 SHA1 ν•΄μ‹œλ‘œ λ³€ν™˜ν•¨.
*/
public String toSHA1Hash(String input) {
MessageDigest sha1;
try {
@karian7
karian7 / Main.java
Last active January 2, 2016 14:08
base62
public abstract class AntiLogarithm62 {
private static final long base = 62; // 62μ§„μˆ˜λ‘œ ν‘œν˜„μœ„ν•΄ λ‚˜λˆ„λŠ” λ³€μˆ˜ κ°’
/**
* 10μ§„μˆ˜λ₯Ό 62μ§„μˆ˜λ‘œ λ³€ν™˜.
*
* @param num10
* long type의 10μ§„μˆ˜.
* @param length