Skip to content

Instantly share code, notes, and snippets.

JinHan LeoHeo

Block or report user

Report or block LeoHeo

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View 1_Annotion.java
@Documented
@Retention(RetentionPolicy.CLASS) // default CLASS -> SOURCE, RUNTIME으로 변경할 필요 없음
@Target(ElementType.METHOD)
public @interface PerformaceLogging {
}
View timeCheck.java
long begin = Sytem.currentTimeMillis();
// do something....
// 기존코드
System.out.println(Sytem.currentTimeMillis() - begin);
@LeoHeo
LeoHeo / axios_file_download.js
Created Sep 20, 2018
axios로 excel 다운로드 할려고 할때 location.href가 아닌 progress bar 뜰 수 있게 하는 방식
View axios_file_download.js
axios.get(url, {
responseType: 'arraybuffer'
}).then(function (response) {
var blob = new Blob([response.data], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' });
var blobURL = window.URL.createObjectURL(blob);
var tempLink = document.createElement('a');
tempLink.style.display = 'none';
tempLink.href = blobURL;
tempLink.setAttribute('download', 'test.xlsx');
document.body.appendChild(tempLink);
View 1_hashCode.java
@Override
public int hashCode() {
return Objects.hash(getId());
}
View coreHashMap.java
public V put(K key, V value) {
return putVal(hash(key), key, value, false, true);
}
static final int hash(Object key) {
int h;
return (key == null) ? 0 : (h = key.hashCode()) ^ (h >>> 16);
}
View coreHashSet.java
public class HashSet<E>
extends AbstractSet<E>
implements Set<E>, Cloneable, java.io.Serializable
{
private transient HashMap<E,Object> map;
/**
* Constructs a new, empty set; the backing <tt>HashMap</tt> instance has
* default initial capacity (16) and load factor (0.75).
*/
View hashSet.java
Set<Student> studentSet = new HashSet<>();
studentSet.add(leo1);
studentSet.add(new Student(1L, "Leo"));
System.out.println("studentSet size => " + studentSet.size()); // studentSet size => 2
View ArrayList.java
List<Student> students = new ArrayList<>();
students.add(leo1);
System.out.println("students contains Leo => " + students.contains(new Student(1L, "Leo"))); // true
View 1_intellij_equals.java
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof Student)) {
return false;
}
Student student = (Student) o;
return Objects.equals(getId(), student.getId()); // Java7+ 부터 사용할 수 있는 `Objects.equals`를 사용해봤다.
View 1_ Student.java
package io.github.leoheo.equals;
/**
* @author Heo, Jin Han
* @since 2018-06-10
*/
public class Student {
private Long id;
private String name;
You can’t perform that action at this time.