Skip to content

Instantly share code, notes, and snippets.

View dittos's full-sized avatar
💥
뿌슝빠슝

Taeho Kim dittos

💥
뿌슝빠슝
View GitHub Profile
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 September 3, 2018 05:52
Saving lazy-loaded entity with IdClass throws TypeMismatchException
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 November 2, 2017 12:17
Kotlin data class + JPA
package org.sapzil
import org.springframework.boot.autoconfigure.SpringBootApplication
@SpringBootApplication
open class Application
@dittos
dittos / gist:0abf8b6dc79d08d6700e9c04b87dfc7f
Created April 5, 2017 09:13
Scala + Java serialization size
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
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 December 6, 2015 12:15
Possibility of React + GWT?
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() {
  • 쓰레드가 N개인 쓰레드 풀이 있습니다.
  • 들어오는 태스크에는 Key가 있어서, Key가 같은 태스크끼리는 들어오는 순서대로 실행되어야 합니다.

예:

Pool Size = 4
@dittos
dittos / Relay Internals.md
Last active August 29, 2015 14:27
Relay Internals
@dittos
dittos / c60.py
Last active August 29, 2015 14:17
@Code_60: Sorting
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 August 29, 2015 14:14
React Component Container Format
name: IconButton
props:
text:
required: true
type: string
description: A button text.
example: Click Me!
icon:
required: true
type: string