Skip to content

Instantly share code, notes, and snippets.

😂
I enjoy

Taeho Kim dittos

😂
I enjoy
Block or report user

Report or block dittos

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 generic.ts
interface X<T> {
// m(o: T): void; // is ok
(o: T): void;
}
class A {
f: X<this>;
}
class B extends A {
@dittos
dittos / JpaBugTest.java
Created Sep 3, 2018
Saving lazy-loaded entity with IdClass throws TypeMismatchException
View JpaBugTest.java
package org.sapzil;
import java.io.Serializable;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.IdClass;
import javax.persistence.ManyToOne;
@dittos
dittos / Application.kt
Last active Nov 2, 2017
Kotlin data class + JPA
View Application.kt
package org.sapzil
import org.springframework.boot.autoconfigure.SpringBootApplication
@SpringBootApplication
open class Application
View gist:0abf8b6dc79d08d6700e9c04b87dfc7f
import java.io._
def sizeOf[T](x:T, y:T): (Long, Long) = {
val buf = new ByteArrayOutputStream
val oos = new ObjectOutputStream(buf)
oos.writeObject(x)
val initSize = buf.size
oos.writeObject(y)
val size = buf.size - initSize
oos.close
View calc_annotated.py
import sys
from ctypes import *
from math import isfinite
'''
1) 수식을 파이썬 바이트코드로 컴파일
수식이 바이트코드로 컴파일 될 때 constant folding이 돼서 너무 간단해져 버리지 않도록 함
lineno table에서 연속된 두 바이트코드의 실제 코드상 라인 번호가 255 이상 차이나면 최적화하지 않는 것을 이용
참고: https://github.com/python/cpython/blob/e4091c77026088cb0611b6e896b1579805253f5b/Python/peephole.c#L403
@dittos
dittos / ReactExample.java
Last active Dec 6, 2015
Possibility of React + GWT?
View ReactExample.java
import static react.ReactDOM.*;
class TodoList extends ReactComponent {
public static final ReactProp<List<TodoItem>> ITEMS = ReactProp.create();
public static ReactElement.Builder<TodoList> builder() {
return ReactElement.builder(TodoList.class);
}
public ReactElement render() {
View Task Queue.md
  • 쓰레드가 N개인 쓰레드 풀이 있습니다.
  • 들어오는 태스크에는 Key가 있어서, Key가 같은 태스크끼리는 들어오는 순서대로 실행되어야 합니다.

예:

Pool Size = 4
@dittos
dittos / Relay Internals.md
Last active Aug 29, 2015
Relay Internals
View Relay Internals.md
@dittos
dittos / c60.py
Last active Aug 29, 2015
@Code_60: Sorting
View c60.py
import sys
from wand.image import Image
from wand.color import Color
from wand.drawing import Drawing
with Image(filename=sys.argv[1]) as img:
pixels = []
for row in img:
for col in row:
pixels.append(col)
@dittos
dittos / IconButton.rsx
Last active Aug 29, 2015
React Component Container Format
View IconButton.rsx
name: IconButton
props:
text:
required: true
type: string
description: A button text.
example: Click Me!
icon:
required: true
type: string
You can’t perform that action at this time.