Skip to content

Instantly share code, notes, and snippets.

View paraya3636's full-sized avatar

Keisuke Miura paraya3636

  • IGNIS LTD.
  • Japan, Tokyo, Ebisu
View GitHub Profile
@paraya3636
paraya3636 / KotlinClassNotFoundException
Created July 27, 2016 03:41
KotlinClassNotFoundException😫
Quit Android Studio
Android Studio → Tools → Kotlin → Configure Kotlin in Project
Clean build
😰
@paraya3636
paraya3636 / Conflict_kapt
Last active August 2, 2016 03:34
Please do not use `com.neenbedankt.android-apt` with kapt.
※It might not work...
※I tried Parceler and PaperParcel, But I don't use Parcelable Library by Kotlin.
1. Remove apply plugin: 'com.neenbedankt.android-apt'
2. Change dependencies kapt to apt
dependencies {
kapt 'com.github.grandstaish.paperparcel:compiler:1.0.0'
@paraya3636
paraya3636 / kotlin_log_tag
Created August 2, 2016 03:38
Android Log Tag by Kotlin
// recommend class.java.simpleName is not wrapped
private val LogTag = MainActivity::class.java.simpleName
// deprecate class.simpleName is wrapped.
private val LogTag = MainActivity::class.simpleName
@paraya3636
paraya3636 / kotlin_reflect
Created August 2, 2016 03:39
Use kotlin-reflect.jar
dependencies {
compile "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
}
@paraya3636
paraya3636 / KotlinHttpStatusCode
Last active January 12, 2017 08:57
HttpStatusCode by Kotlin
enum class HttpStatusCode(val value: Int) {
Default(0),
Continue(100),
SwitchingProtocols(101),
Processing(102),
Ok(200),
Created(201),
Accepted(202),
@paraya3636
paraya3636 / when-is
Created February 10, 2017 09:49
when-is control by Kotlin
val value: T
when(value) {
is String -> ...
is Int -> ...
else -> ...
}
@paraya3636
paraya3636 / simpleModel.py
Last active February 14, 2017 04:09
与えられた値を2倍にする by Python3.5 & Chainer1.12
#!/usr/bin/env/ python
# coding:utf-8
import numpy as np
import chainer.links as L
from chainer import functions as F
from chainer import Variable, optimizers, Chain
class Model(Chain):
def __init__(self):
@paraya3636
paraya3636 / simpleModel.py
Created February 14, 2017 04:27
OR演算 Python3.5&Chainer1.12
#!/usr/bin/env/ python
# coding:utf-8
import numpy as np
import chainer.links as L
from chainer import functions as F
from chainer import Variable, optimizers, Chain
class Model(Chain):
def __init__(self):
@paraya3636
paraya3636 / simpleModel.py
Created February 14, 2017 04:30
AND演算 by Python3.5 & Chainer1.12
#!/usr/bin/env/ python
# coding:utf-8
import numpy as np
import chainer.links as L
from chainer import functions as F
from chainer import Variable, optimizers, Chain
class Model(Chain):
def __init__(self):
@paraya3636
paraya3636 / transparent_toolbar
Created July 20, 2017 06:04
Change toolbar alpha by ScrollView
// Notify scroll
class ObservableScrollView : ScrollView {
interface OnScrollChangeListener {
fun OnScrollChangeListener(scrollView: ObservableScrollView, x: Int, y: Int, oldX: Int, oldY: Int)
}
var onScrollChangeListener: OnScrollChangeListener? = null
constructor(context: Context) : this(context, null)
constructor(context: Context, attrs: AttributeSet?) : this(context, attrs, 0)
constructor(context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0) : super(context, attrs, defStyleAttr)